import "../base.api"
import "./agent.api"

type (
    // The data of api_key information | ApiKey信息
    ApiKeyInfo {
        BaseIDInfo

        // Title
        Title  *string `json:"title,optional"`

        // Key
        Key  *string `json:"key,optional"`

		// 租户ID
		OrganizationId *uint64 `json:"organization_id,optional"`

		AgentId *uint64 `json:"agent_id,optional"`

		AgentInfo *AgentInfo `json:"agent_info,optional"`

        CustomAgentBase *string `json:"custom_agent_base,optional"`

        CustomAgentKey *string `json:"custom_agent_key,optional"`

        OpenaiBase *string `json:"openai_base,optional"`

        OpenaiKey *string `json:"openai_key,optional"`
    }

    // The response data of api_key list | ApiKey列表数据
    ApiKeyListResp {
        BaseDataInfo

        // ApiKey list data | ApiKey列表数据
        Data ApiKeyListInfo `json:"data"`
    }

    // ApiKey list data | ApiKey列表数据
    ApiKeyListInfo {
        BaseListInfo

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

    // Get ApiKey list request params | ApiKey列表请求参数
    ApiKeyListReq {
        PageInfo

        // Key
        Key  *string `json:"key,optional"`

        OrganizationId *uint64 `json:"organization_id,optional"`
    }
)

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

service Wechat {
	// Create api_key information | 创建ApiKey
	@handler createApiKey
	post /api_key/create (ApiKeyInfo) returns (BaseMsgResp)

	// Update api_key information | 更新ApiKey
	@handler updateApiKey
	post /api_key/update (ApiKeyInfo) returns (BaseMsgResp)

	// Delete api_key information | 删除ApiKey信息
	@handler deleteApiKey
	post /api_key/delete (IDsReq) returns (BaseMsgResp)

	// Get api_key list | 获取ApiKey列表
	@handler getApiKeyList
	post /api_key/list (ApiKeyListReq) returns (ApiKeyListResp)

}
