import "../base.api"

type (
    // The data of category information | Category信息
    CategoryInfo {
        BaseIDInfo

        // name | 角色名称 
        Name  *string `json:"name,optional"`

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

    // The response data of category list | Category列表数据
    CategoryListResp {
        BaseDataInfo

        // Category list data | Category列表数据
        Data CategoryListInfo `json:"data"`
    }

    // Category list data | Category列表数据
    CategoryListInfo {
        BaseListInfo

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

    // Get category list request params | Category列表请求参数
    CategoryListReq {
        PageInfo

        // name | 角色名称 
        Name  *string `json:"name,optional"`
    }

    // Category information response | Category信息返回体
    CategoryInfoResp {
        BaseDataInfo

        // Category information | Category数据
        Data CategoryInfo `json:"data"`
    }
)

@server(
//	jwt: Auth
	group: category
//	middleware: Miniprogram
)

service Wechat {
	// Get category list | 获取 category 列表
	@handler getApiCategoryList
	post /api/category/list returns (CategoryListResp)
}

@server(
    group: category
)

service Wechat {
	// Get category list | 获取Category列表
    @handler getCategoryList
    post /category/list (CategoryListReq) returns (CategoryListResp)

    // Get category by ID | 通过ID获取Category
    @handler getCategoryById
    post /category (IDReq) returns (CategoryInfoResp)
}

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

service Wechat {
	// Create category information | 创建Category
	@handler createCategory
	post /category/create (CategoryInfo) returns (BaseMsgResp)

	// Update category information | 更新Category
	@handler updateCategory
	post /category/update (CategoryInfo) returns (BaseMsgResp)

	// Delete category information | 删除Category信息
	@handler deleteCategory
	post /category/delete (IDsReq) returns (BaseMsgResp)
}