package dto

import "time"

type LoginRequest struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	Captcha   string `json:"captcha"`
	CaptchaID string `json:"captchaId"`
}

type Route struct {
	Path   string
	Method string
}

type UserListRequest 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"`
	OrderKey string `json:"orderKey"`
	Desc     bool   `json:"desc"`
}

type UserRequest struct {
	ID           uint   `json:"ID" form:"id"`
	Username     string `json:"userName"`
	Password     string `json:"passWord"`
	NickName     string `json:"nickName"`
	HeaderImg    string `json:"headerImg"`
	AuthorityID  uint   `json:"authorityId"`
	AuthorityIDs []uint `json:"authorityIds"`
	Enable       int    `json:"enable"`
	Phone        string `json:"phone"`
	Email        string `json:"email"`
}

type SelfUserRequest struct {
	NickName  string `json:"nickName"`
	HeaderImg string `json:"headerImg"`
	Phone     string `json:"phone"`
	Email     string `json:"email"`
	Enable    int    `json:"enable"`
}

type ResetPasswordRequest struct {
	ID       uint   `json:"ID"`
	Password string `json:"password"`
}

type ChangePasswordRequest struct {
	Password    string `json:"password"`
	NewPassword string `json:"newPassword"`
}

type UserAuthoritiesRequest struct {
	ID           uint   `json:"ID"`
	AuthorityIDs []uint `json:"authorityIds"`
}

type SwitchAuthorityRequest struct {
	AuthorityID uint `json:"authorityId"`
}

type LoginLogRequest struct {
	Username     string
	IP           string
	Status       bool
	ErrorMessage string
	Agent        string
	UserID       uint
}

type UserResponse struct {
	ID                uint                  `json:"ID"`
	CreatedAt         time.Time             `json:"CreatedAt"`
	UpdatedAt         time.Time             `json:"UpdatedAt"`
	DeletedAt         any                   `json:"-"`
	UUID              string                `json:"uuid"`
	Username          string                `json:"userName"`
	NickName          string                `json:"nickName"`
	HeaderImg         string                `json:"headerImg"`
	AuthorityID       uint                  `json:"authorityId"`
	Authority         *AuthorityResponse    `json:"authority"`
	Authorities       []*AuthorityResponse  `json:"authorities"`
	DeptID            uint                  `json:"deptId"`
	Department        any                   `json:"dept"`
	Departments       []*DepartmentResponse `json:"departments"`
	Positions         []*PositionResponse   `json:"positions"`
	Phone             string                `json:"phone"`
	Email             string                `json:"email"`
	Enable            int                   `json:"enable"`
	OriginSetting     map[string]any        `json:"originSetting"`
	PasswordUpdatedAt *time.Time            `json:"passwordUpdatedAt"`
}

type ServerInfoResponse struct {
	OS   ServerOSResponse     `json:"os"`
	CPU  ServerCPUResponse    `json:"cpu"`
	RAM  ServerRAMResponse    `json:"ram"`
	Disk []ServerDiskResponse `json:"disk"`
}

type ServerOSResponse struct {
	GOOS         string `json:"goos"`
	NumCPU       int    `json:"numCpu"`
	Compiler     string `json:"compiler"`
	GoVersion    string `json:"goVersion"`
	NumGoroutine int    `json:"numGoroutine"`
}

type ServerCPUResponse struct {
	CPUs  []float64 `json:"cpus"`
	Cores int       `json:"cores"`
}

type ServerRAMResponse struct {
	UsedMB      uint64 `json:"usedMb"`
	TotalMB     uint64 `json:"totalMb"`
	UsedPercent int    `json:"usedPercent"`
}

type ServerDiskResponse struct {
	MountPoint  string `json:"mountPoint"`
	UsedMB      uint64 `json:"usedMb"`
	UsedGB      uint64 `json:"usedGb"`
	TotalMB     uint64 `json:"totalMb"`
	TotalGB     uint64 `json:"totalGb"`
	UsedPercent int    `json:"usedPercent"`
}
