package dto

// ShopAccountListRequest 代理商账号列表查询请求
type ShopAccountListRequest struct {
	Page     int    `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"`
	PageSize int    `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"`
	ShopID   *uint  `json:"shop_id" query:"shop_id" validate:"omitempty,min=1" minimum:"1" description:"店铺ID过滤"`
	Username string `json:"username" query:"username" validate:"omitempty,max=50" maxLength:"50" description:"用户名（模糊查询）"`
	Phone    string `json:"phone" query:"phone" validate:"omitempty,len=11" minLength:"11" maxLength:"11" description:"手机号（精确查询）"`
	Status   *int   `json:"status" query:"status" validate:"omitempty,oneof=0 1" description:"状态 (0:禁用, 1:启用)"`
}

// CreateShopAccountRequest 创建代理商账号请求
type CreateShopAccountRequest struct {
	ShopID   uint   `json:"shop_id" validate:"required,min=1" required:"true" minimum:"1" description:"店铺ID"`
	Username string `json:"username" validate:"required,min=3,max=50" required:"true" minLength:"3" maxLength:"50" description:"用户名"`
	Phone    string `json:"phone" validate:"required,len=11" required:"true" minLength:"11" maxLength:"11" description:"手机号"`
	Password string `json:"password" validate:"required,min=8,max=32" required:"true" minLength:"8" maxLength:"32" description:"密码"`
}

// UpdateShopAccountRequest 更新代理商账号请求（不包含 phone 和 password，按照业务规则不允许修改）
type UpdateShopAccountRequest struct {
	Username string `json:"username" validate:"required,min=3,max=50" required:"true" minLength:"3" maxLength:"50" description:"用户名"`
}

// UpdateShopAccountPasswordRequest 修改代理商账号密码请求（管理员重置）
type UpdateShopAccountPasswordRequest struct {
	NewPassword string `json:"new_password" validate:"required,min=8,max=32" required:"true" minLength:"8" maxLength:"32" description:"新密码"`
}

// UpdateShopAccountStatusRequest 修改代理商账号状态请求
type UpdateShopAccountStatusRequest struct {
	Status int `json:"status" validate:"required,oneof=0 1" required:"true" description:"状态 (0:禁用, 1:启用)"`
}

// ShopAccountResponse 代理商账号响应
type ShopAccountResponse struct {
	ID        uint   `json:"id" description:"账号ID"`
	ShopID    uint   `json:"shop_id" description:"店铺ID"`
	ShopName  string `json:"shop_name,omitempty" description:"店铺名称"`
	Username  string `json:"username" description:"用户名"`
	Phone     string `json:"phone" description:"手机号"`
	UserType  int    `json:"user_type" description:"用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)"`
	Status    int    `json:"status" description:"状态 (0:禁用, 1:启用)"`
	CreatedAt string `json:"created_at" description:"创建时间"`
	UpdatedAt string `json:"updated_at" description:"更新时间"`
}

// ShopAccountPageResult 代理账号分页响应
type ShopAccountPageResult struct {
	Items []ShopAccountResponse `json:"items" description:"代理账号列表"`
	Total int64                 `json:"total" description:"总记录数"`
	Page  int                   `json:"page" description:"当前页码"`
	Size  int                   `json:"size" description:"每页数量"`
}

// UpdateShopAccountParams 更新代理账号聚合参数 (用于文档生成)
type UpdateShopAccountParams struct {
	IDReq
	UpdateShopAccountRequest
}

// UpdateShopAccountPasswordParams 修改代理账号密码聚合参数 (用于文档生成)
type UpdateShopAccountPasswordParams struct {
	IDReq
	UpdateShopAccountPasswordRequest
}

// UpdateShopAccountStatusParams 修改代理账号状态聚合参数 (用于文档生成)
type UpdateShopAccountStatusParams struct {
	IDReq
	UpdateShopAccountStatusRequest
}
