syntax = "v1"

type (
	// Department request | 部门查询请求
	// swagger:parameters GetDepartmentListAdmin GetDepartmentAdmin
	DepartmentReq {
		BaseID
		*Pagination

		// 部门名称
		Name string `json:"name,optional" form:"name,optional"`

		// Leader ID | 负责人ID
		LeaderId int64 `json:"leaderId,string,optional" form:"leaderId,optional"`

		// Parent ID | 父节点ID
		ParentId int64 `json:"parentId,string,optional" form:"parentId,optional"`
	}

		// Department list response | 部门列表返回
	DepartmentListResp {
		// Page | 分页数据
		Page *Pagination `json:"page,optional"`

		// List | 数据列表
		List []*DepartmentInfo `json:"list"`
	}
)

@server(
	jwt: Auth
	group: department_admin
	middleware: Authority
	prefix: /api/admin/department
)
service api {
	// Create department | 创建部门
	@handler createDepartmentAdmin
	post /create (DepartmentInfo) returns (BaseID)

	// Update department info | 更新部门信息
	@handler updateDepartmentAdmin
	post /update (DepartmentInfo)

	// Get department list | 获取部门列表
	@handler getDepartmentListAdmin
	get /list (DepartmentReq) returns (DepartmentListResp)

	// Get department | 获取部门
	@handler getDepartmentAdmin
	get / (DepartmentReq) returns (DepartmentInfo)

	// Delete department | 删除部门
	@handler deleteDepartmentAdmin
	delete / (BaseIDs)
}