package system

// UserInfo 用户信息
type UserInfo struct {
	ID            uint            `json:"id"`
	UUID          string          `json:"uuid"`
	Username      string          `json:"userName"`
	NickName      string          `json:"nickName"`
	SideMode      string          `json:"sideMode"`
	HeaderImg     string          `json:"headerImg"`
	BaseColor     string          `json:"baseColor"`
	AuthorityId   uint            `json:"authorityId"`
	Phone         string          `json:"phone"`
	Email         string          `json:"email"`
	Enable        int             `json:"enable"`
	OriginSetting string          `json:"originSetting,omitempty"`
	Authority     *AuthorityInfo  `json:"authority,omitempty"`
	Authorities   []AuthorityInfo `json:"authorities,omitempty"`
}

// AuthorityInfo 角色信息
type AuthorityInfo struct {
	AuthorityId   uint   `json:"authorityId"`
	AuthorityName string `json:"authorityName"`
	ParentId      *uint  `json:"parentId,omitempty"`
	DefaultRouter string `json:"defaultRouter"`
}

// LoginRequest 登录请求
type LoginRequest struct {
	Username  string `json:"username" binding:"required"`
	Password  string `json:"password" binding:"required"`
	Captcha   string `json:"captcha"`
	CaptchaId string `json:"captchaId"`
}

// LoginReply 登录响应
type LoginReply struct {
	User      UserInfo `json:"user"`
	Token     string   `json:"token"`
	ExpiresAt int64    `json:"expiresAt"`
}

// RegisterRequest 注册请求
type RegisterRequest struct {
	Username     string `json:"userName" binding:"required"`
	Password     string `json:"passWord" binding:"required"`
	NickName     string `json:"nickName"`
	HeaderImg    string `json:"headerImg"`
	AuthorityId  uint   `json:"authorityId"`
	AuthorityIds []uint `json:"authorityIds"`
	Phone        string `json:"phone"`
	Email        string `json:"email"`
	Enable       int    `json:"enable"`
}

// UserInfoReply 用户信息响应
type UserInfoReply struct {
	User UserInfo `json:"user"`
}

// ChangePasswordRequest 修改密码请求
type ChangePasswordRequest struct {
	Password    string `json:"password" binding:"required"`
	NewPassword string `json:"newPassword" binding:"required"`
}

// ResetPasswordRequest 重置密码请求
type ResetPasswordRequest struct {
	ID       uint   `json:"ID" binding:"required"`
	Password string `json:"password" binding:"required"`
}

// GetUserInfoReply 获取用户信息响应
type GetUserInfoReply struct {
	UserInfo UserInfo `json:"userInfo"`
}

// GetUserListRequest 获取用户列表请求
type GetUserListRequest struct {
	Page     int    `json:"page"`
	PageSize int    `json:"pageSize"`
	Username string `json:"username"`
	NickName string `json:"nickName"`
	Phone    string `json:"phone"`
	Email    string `json:"email"`
}

// GetUserListReply 获取用户列表响应
type GetUserListReply struct {
	List     []UserInfo `json:"list"`
	Total    int64      `json:"total"`
	Page     int        `json:"page"`
	PageSize int        `json:"pageSize"`
}

// SetUserInfoRequest 设置用户信息请求
type SetUserInfoRequest struct {
	ID           uint   `json:"ID" binding:"required"`
	NickName     string `json:"nickName"`
	HeaderImg    string `json:"headerImg"`
	Phone        string `json:"phone"`
	Email        string `json:"email"`
	Enable       int    `json:"enable"`
	AuthorityIds []uint `json:"authorityIds"`
}

// SetSelfInfoRequest 设置自己信息请求
type SetSelfInfoRequest struct {
	NickName  string `json:"nickName"`
	HeaderImg string `json:"headerImg"`
	Phone     string `json:"phone"`
	Email     string `json:"email"`
	SideMode  string `json:"sideMode"`
	BaseColor string `json:"baseColor"`
}

// SetSelfSettingRequest 设置自己配置请求
type SetSelfSettingRequest struct {
	Setting string `json:"setting"`
}

// DeleteUserRequest 删除用户请求
type DeleteUserRequest struct {
	ID uint `json:"ID" binding:"required"`
}

// SetUserAuthorityRequest 设置用户角色请求
type SetUserAuthorityRequest struct {
	AuthorityId uint `json:"authorityId" binding:"required"`
}

// SetUserAuthorityReply 设置用户角色响应
type SetUserAuthorityReply struct {
	Token     string `json:"token"`
	ExpiresAt int64  `json:"expiresAt"`
}

// SetUserAuthoritiesRequest 设置用户多角色请求
type SetUserAuthoritiesRequest struct {
	ID           uint   `json:"ID" binding:"required"`
	AuthorityIds []uint `json:"authorityIds" binding:"required"`
}
