import "../base.api"

type (
    // The data of chat session information | ChatSession信息
    ChatSessionInfo {
        BaseIDInfo

        // 名称 
        Name  *string `json:"name,optional"`

        // 用户ID 
        UserId  *uint64 `json:"userId,optional"`

        UserName  *string `json:"userName,optional"`

        // 聊天ID 
        BotId  *uint64 `json:"botId,optional"`

        // 主体名称
        BotName  *string `json:"botName,optional"`

        // 类型:1-微信 2-小程序card 3-智能体 
        BotType  *uint8 `json:"botType,optional"`

        // 类型:1-微信 2-小程序card 3-智能体
        BotTypeStr  *string `json:"botTypeStr,optional"`
    }

    // The response data of chat session list | ChatSession列表数据
    ChatSessionListResp {
        BaseDataInfo

        // ChatSession list data | ChatSession列表数据
        Data ChatSessionListInfo `json:"data"`
    }

    // ChatSession list data | ChatSession列表数据
    ChatSessionListInfo {
        BaseListInfo

        // The API list data | ChatSession列表数据
        Data  []ChatSessionInfo  `json:"data"`
    }

    // Get chat session list request params | ChatSession列表请求参数
    ChatSessionListReq {
        PageInfo

		BotId  *uint64 `json:"botId,optional"`
        BotType  *uint8 `json:"botType,optional"`
		BotName *string `json:"botName,optional"`
    }

    // ChatSession information response | ChatSession信息返回体
    ChatSessionInfoResp {
        BaseDataInfo

        // ChatSession information | ChatSession数据
        Data ChatSessionInfo `json:"data"`
    }
)

@server(
	jwt: Auth
	group: chatsession
	middleware: Miniprogram
)

service Wechat {
	// Get chat session list | 获取ChatSession列表
	@handler getApiSessionList
	post /api/session/list (ChatSessionListReq) returns (ChatSessionListResp)

	// Update chat session information | 更新ChatSession
	@handler updateApiSession
	post /api/session/update (ChatSessionInfo) returns (BaseMsgResp)

	// Delete chat session information | 删除ChatSession信息
	@handler deleteApiSession
	post /api/session/delete (IDsReq) returns (BaseMsgResp)
}


@server(
    jwt: Auth
    group: chatsession
    middleware: Authority
)

service Wechat {
    // Create chat session information | 创建ChatSession
    @handler createChatSession
    post /chat_session/create (ChatSessionInfo) returns (BaseMsgResp)

    // Update chat session information | 更新ChatSession
    @handler updateChatSession
    post /chat_session/update (ChatSessionInfo) returns (BaseMsgResp)

    // Delete chat session information | 删除ChatSession信息
    @handler deleteChatSession
    post /chat_session/delete (IDsReq) returns (BaseMsgResp)

    // Get chat session list | 获取ChatSession列表
    @handler getChatSessionList
    post /chat_session/list (ChatSessionListReq) returns (ChatSessionListResp)

    // Get chat session by ID | 通过ID获取ChatSession
    @handler getChatSessionById
    post /chat_session (IDReq) returns (ChatSessionInfoResp)
}