import "../base.api"

type (
    CreateInfo {
        // Translated Name | 展示名称
        UserName string `json:"username"`

        // Name | 部门名称
        Title *string `json:"title"`
    }

    AppsListReq {
        Type string `json:"type"`

        Keyword *string `json:"keyword,optional"`
    }

    AppsListResp {
        BaseDataInfo

        Data []*AppsListRespInfo `json:"data"`
    }

    AppsListRespInfo {
        Id string `json:"_id"`

        TeamId string `json:"teamId"`

        TmbId string `json:"tmbId"`

        Avatar string `json:"avatar"`

        Name string `json:"name"`

        Intro string `json:"intro"`
    }

    CreateAppsReq {
        Type string `json:"type"`
        Name string `json:"name"`
        Intro *string `json:"intro,optional"`
    }

    UpdateAppsReq {
        Id string `json:"id"`
        Name string `json:"name"`
        Intro *string `json:"intro,optional"`
    }

    DeleteAppsReq {
        Id string `json:"id"`
    }
)

@server(
    group: fastgpt
)

service Wechat {
    @handler setToken
    get /api/fastgpt/set_token () returns (BaseMsgResp)

    // 创建 fastgpt 租户
    @handler CreateFastgpt
    post /api/fastgpt/create (CreateInfo) returns (BaseMsgResp)
}

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

service Wechat {
    @handler GetAppsList
    post /api/fastgpt/apps_list (AppsListReq) returns (AppsListResp)

    @handler CreateApp
    post /api/fastgpt/create_app (CreateAppsReq) returns (BaseMsgResp)

    @handler UpdateApp
    post /api/fastgpt/update_app (UpdateAppsReq) returns (BaseMsgResp)

    @handler DeleteApp
    post /api/fastgpt/delete_app (DeleteAppsReq) returns (BaseMsgResp)
}