syntax = "v1"

type (
	// User request | 用户查询参数
	// swagger:parameters GetUserAdmin GetUserListAdmin
	UserReq {
		BaseID
		*Pagination

		// Username | 用户名
		Username string `json:"username,optional" form:"username,optional"`
		// PhoneNumber | 手机号码
		PhoneNumber string `json:"phoneNumber,optional" form:"phoneNumber,optional"`
		// Email | 邮箱
		Email string `json:"email,optional" form:"email,optional"`
		// Nickname | 昵称
		Nickname string `json:"nickname,optional" form:"nickname,optional"`
	}

		// User list response | 用户列表返回
	UserListResp {
		// Page | 分页数据
		Page *Pagination `json:"page,optional"`

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

@server(
	group: user_admin
	prefix: /api/admin/user
	jwt: Auth
	middleware: Authority
)
service api {
	// Create user | 创建用户
	@handler createUserAdmin
	post /create (UserInfo) returns (BaseID)

	// Update user | 更新用户信息
	@handler updateUserAdmin
	post /update (UserInfo)

	// Get user list | 获取用户列表
	@handler getUserListAdmin
	get /list (UserReq) returns (UserListResp)

	// Get user | 获取用户
	@handler getUserAdmin
	get / (UserReq) returns (UserInfo)

	// Delete user | 删除用户
	@handler deleteUserAdmin
	delete / (BaseIDs)
}

@server(
	group: user
	prefix: /api/user
	jwt: Auth
	middleware: Authority
)
service api {
	// Get Current User | 获取当前登录用户信息
	@handler getCurrentUser
	get / returns (UserInfo)
}