package appuser

import "hyapp-admin-server/internal/modules/shared"

type listQuery struct {
	Page          int
	PageSize      int
	Country       string
	Keyword       string
	UserFilter    shared.UserIdentityFilter
	RegionID      int64
	RegionIDSet   bool
	Status        string
	SortBy        string
	SortDirection string
	StartMs       int64
	EndMs         int64
	// SnapshotAtMs 只由异步导出设置，使短号租约和筛选时间基线在所有分页中保持一致。
	SnapshotAtMs int64
	// ExportCursor* 仅在 job worker 内存中推进 keyset；不进入任务 payload，也不暴露为 HTTP 查询参数。
	ExportCursorCreatedAtMs int64 `json:"-"`
	ExportCursorUserID      int64 `json:"-"`
}

type loginLogQuery struct {
	Page          int
	PageSize      int
	Keyword       string
	UserFilter    shared.UserIdentityFilter
	UserID        int64
	DisplayUserID string
	IP            string
	IPCountryCode string
	Channel       string
	Platform      string
	Result        string
	Blocked       string
	RegionID      int64
	RegionIDSet   bool
	StartMs       int64
	EndMs         int64
}

type banListQuery struct {
	Page                 int
	PageSize             int
	TargetKeyword        string
	TargetFilter         shared.UserIdentityFilter
	OperatorKeyword      string
	OperatorFilter       shared.UserIdentityFilter
	OperatorAdminKeyword string
	StartMs              int64
	EndMs                int64
}

type updateUserRequest struct {
	Avatar   *string `json:"avatar"`
	Country  *string `json:"country"`
	Gender   *string `json:"gender"`
	Username *string `json:"username"`
}

type setPasswordRequest struct {
	Password string `json:"password" binding:"required"`
}

type temporaryLevelAdjustmentRequest struct {
	Track        string `json:"track" binding:"required"`
	Level        int32  `json:"level" binding:"required"`
	DurationDays int32  `json:"duration_days" binding:"required"`
}

type adjustTemporaryLevelsRequest struct {
	Adjustments []temporaryLevelAdjustmentRequest `json:"adjustments" binding:"required,min=1,max=2,dive"`
	Reason      string                            `json:"reason"`
}

type banUserRequest struct {
	ExpiresAtMs int64  `json:"expires_at_ms"`
	Reason      string `json:"reason"`
}

type unbanUserRequest struct {
	Reason string `json:"reason"`
}
