// Generated by [optioner] command-line tool; DO NOT EDIT
// If you have any questions, please create issues and submit contributions at:
// https://github.com/chenmingyong0423/go-optioner

package yuanqi

import (
	"time"
)

//go:generate optioner -type Chat -output chat.go -mode append
type Chat struct {
	AssistantId      string `opt:"-"` // 助手ID
	UserId           string `opt:"-"` // 用户ID，调用者业务侧的用户ID，会影响智能体的数据统计，建议按实际情况填写
	Token            string `opt:"-"` // Token
	AssistantVersion string ``        // 助手版本 (仅对内部开放)，可选

	Timeout time.Duration // 会话请求超时时间，可选
}

func (c *Chat) Session() *Session {
	return NewSession(c)
}

type ChatOption func(*Chat)

func NewChat(assistantId string, userId string, token string, opts ...ChatOption) *Chat {
	chat := &Chat{
		AssistantId: assistantId,
		UserId:      userId,
		Token:       token,
	}

	for _, opt := range opts {
		opt(chat)
	}

	return chat
}

func WithAssistantVersion(assistantVersion string) ChatOption {
	return func(chat *Chat) {
		chat.AssistantVersion = assistantVersion
	}
}

func WithTimeOut(timeOut time.Duration) ChatOption {
	return func(chat *Chat) {
		chat.Timeout = timeOut
	}
}
