import "../base.api"

type (
    // The data of credit balance information | CreditBalance信息
    CreditBalanceInfo {
        BaseIDInfo

        // user_id | 用户ID 
//        UserId  *string `json:"userId,optional"`

        // role | 角色设定 
        Balance  *float64 `json:"balance,optional"`

        // status | 状态 1-正常 2-禁用 
        Status  *int `json:"status,optional"`

        // organization_id | 租户ID 
        OrganizationId  *uint64 `json:"organizationId,optional"`
		OrganizationName  *string `json:"organizationName,optional"`
    }

    // The response data of credit balance list | CreditBalance列表数据
    CreditBalanceListResp {
        BaseDataInfo

        // CreditBalance list data | CreditBalance列表数据
        Data CreditBalanceListInfo `json:"data"`
    }

    // CreditBalance list data | CreditBalance列表数据
    CreditBalanceListInfo {
        BaseListInfo

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

    // Get credit balance list request params | CreditBalance列表请求参数
    CreditBalanceListReq {
        PageInfo

        // user_id | 用户ID 
        UserId  *string `json:"userId,optional"`

		OrganizationId  *uint64 `json:"organizationId,optional"`
    }

    // CreditBalance information response | CreditBalance信息返回体
    CreditBalanceInfoResp {
        BaseDataInfo

        // CreditBalance information | CreditBalance数据
        Data CreditBalanceInfo `json:"data"`
    }

	CreditBalanceOperateReq {
		OrganizationId  *uint64 `json:"organizationId,optional"`
		Number  *float64 `json:"number,optional"`
		PayNumber *float64 `json:"payNumber,optional"`
		PayMethod *int `json:"payMethod,optional"`
		Reason *string `json:"reason,optional"`
	}
)

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

service Wechat {
    // Create credit balance information | 创建CreditBalance
    @handler createCreditBalance
    post /credit_balance/create (CreditBalanceInfo) returns (BaseMsgResp)

    // Update credit balance information | 更新CreditBalance
    @handler updateCreditBalance
    post /credit_balance/update (CreditBalanceInfo) returns (BaseMsgResp)

    // Delete credit balance information | 删除CreditBalance信息
    @handler deleteCreditBalance
    post /credit_balance/delete (IDsReq) returns (BaseMsgResp)

    // Get credit balance list | 获取CreditBalance列表
    @handler getCreditBalanceList
    post /credit_balance/list (CreditBalanceListReq) returns (CreditBalanceListResp)

    // Get credit balance by ID | 通过ID获取CreditBalance
    @handler getCreditBalanceById
    post /credit_balance (IDReq) returns (CreditBalanceInfoResp)

	// Get credit balance by ID | 通过ID获取CreditBalance
	@handler operateCreditBalance
	post /credit_balance/operate (CreditBalanceOperateReq) returns (BaseMsgResp)
}
