import "../base.api"

type (
    // The data of whatsapp channel information | WhatsappChannel信息
    WhatsappChannelInfo {
        BaseIDInfo

        // Status 1: normal 2: ban | 状态 1 正常 2 禁用 
        Status  *uint8 `json:"status,optional"`

        // ak 
        Ak  *string `json:"ak,optional"`

        // 端口号 
        Sk  *string `json:"sk,optional"`

        // 通道ID 
        WaId  *string `json:"waId,optional"`

        // 通道名 
        WaName  *string `json:"waName,optional"`

        // WABA ID 
        WabaId  *uint64 `json:"wabaId,optional"`

        // 商业平台ID 
        BusinessId  *uint64 `json:"businessId,optional"`

        // 机构 ID 
        OrganizationId  *uint64 `json:"organizationId,optional"`
		OrganizationName  *string `json:"organizationName,optional"`

        // 认证主体 
        VerifyAccount  *string `json:"verifyAccount,optional"`
    }

    // The response data of whatsapp channel list | WhatsappChannel列表数据
    WhatsappChannelListResp {
        BaseDataInfo

        // WhatsappChannel list data | WhatsappChannel列表数据
        Data WhatsappChannelListInfo `json:"data"`
    }

    // WhatsappChannel list data | WhatsappChannel列表数据
    WhatsappChannelListInfo {
        BaseListInfo

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

    // Get whatsapp channel list request params | WhatsappChannel列表请求参数
    WhatsappChannelListReq {
        PageInfo

		OrganizationId  *uint64 `json:"organizationId,optional"`
		WaName  *string `json:"waName,optional"`
		WaID  *string `json:"waID,optional"`
		WabaId  *uint64 `json:"wabaId,optional"`
		VerifyAccount  *string `json:"verifyAccount,optional"`
    }

    // WhatsappChannel information response | WhatsappChannel信息返回体
    WhatsappChannelInfoResp {
        BaseDataInfo

        // WhatsappChannel information | WhatsappChannel数据
        Data WhatsappChannelInfo `json:"data"`
    }
)

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

service Wechat {
    // Create whatsapp channel information | 创建WhatsappChannel
    @handler createWhatsappChannel
    post /whatsapp_channel/create (WhatsappChannelInfo) returns (BaseMsgResp)

    // Update whatsapp channel information | 更新WhatsappChannel
    @handler updateWhatsappChannel
    post /whatsapp_channel/update (WhatsappChannelInfo) returns (BaseMsgResp)

    // Delete whatsapp channel information | 删除WhatsappChannel信息
    @handler deleteWhatsappChannel
    post /whatsapp_channel/delete (IDsReq) returns (BaseMsgResp)

    // Get whatsapp channel list | 获取WhatsappChannel列表
    @handler getWhatsappChannelList
    post /whatsapp_channel/list (WhatsappChannelListReq) returns (WhatsappChannelListResp)

	// Get whatsapp channel list | 获取WhatsappChannel列表
	@handler getWhatsappChannelSearch
	post /whatsapp_channel/search (WhatsappChannelListReq) returns (WhatsappChannelListResp)

    // Get whatsapp channel by ID | 通过ID获取WhatsappChannel
    @handler getWhatsappChannelById
    post /whatsapp_channel (IDReq) returns (WhatsappChannelInfoResp)
}
