import "../base.api"

type (
    // The response data of wx information | Wx信息
    WxInfo {
        BaseIDInfo

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

        // 服务器id 
        ServerId  *uint64 `json:"serverId,optional"`

        // 端口号 
        Port  *string `json:"port,optional"`

        // 进程号 
        ProcessId  *string `json:"processId,optional"`

        // 回调地址 
        Callback  *string `json:"callback,optional"`

        // 微信id 
        Wxid  *string `json:"wxid,optional"`

        // 微信账号 
        Account  *string `json:"account,optional"`

        // 微信昵称 
        Nickname  *string `json:"nickname,optional"`

        // 手机号 
        Tel  *string `json:"tel,optional"`

        // 微信头像 
        HeadBig  *string `json:"headBig,optional"`

        // 组织ID
        OrganizationId *uint64 `json:"organizationId,optional"`
    }

    // The response data of wx list | Wx列表数据
    WxListResp {
        BaseDataInfo

        // Wx list data | Wx列表数据
        Data WxListInfo `json:"data"`
    }

    // Wx list data | Wx列表数据
    WxListInfo {
        BaseListInfo

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

    // Get wx list request params | Wx列表请求参数
    WxListReq {
        PageInfo

        // 端口号 
        Port  *string `json:"port,optional"`

        // 进程号 
        ProcessId  *string `json:"processId,optional"`

        // 回调地址 
        Callback  *string `json:"callback,optional"`
    }

    // Wx information response | Wx信息返回体
    WxInfoResp {
        BaseDataInfo

        // Wx information | Wx数据
        Data WxInfo `json:"data"`
    }
)

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

service Wechat {
    // Create wx information | 创建Wx
    @handler createWx
    post /wx/create (WxInfo) returns (BaseMsgResp)

    // Update wx information | 更新Wx
    @handler updateWx
    post /wx/update (WxInfo) returns (BaseMsgResp)

    // Delete wx information | 删除Wx信息
    @handler deleteWx
    post /wx/delete (IDsReq) returns (BaseMsgResp)

    // Get wx list | 获取Wx列表
    @handler getWxList
    post /wx/list (WxListReq) returns (WxListResp)

    // Get wx by ID | 通过ID获取Wx
    @handler getWxById
    post /wx (IDReq) returns (WxInfoResp)
}