package dto

// CreatePackageRequest 创建套餐请求
type CreatePackageRequest struct {
	PackageCode          string  `json:"package_code" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"套餐编码"`
	PackageName          string  `json:"package_name" validate:"required,min=1,max=255" required:"true" minLength:"1" maxLength:"255" description:"套餐名称"`
	SeriesID             *uint   `json:"series_id" validate:"omitempty" description:"套餐系列ID"`
	PackageType          string  `json:"package_type" validate:"required,oneof=formal addon" required:"true" description:"套餐类型 (formal:正式套餐, addon:附加套餐)"`
	DurationMonths       int     `json:"duration_months" validate:"required,min=1,max=120" required:"true" minimum:"1" maximum:"120" description:"套餐时长(月数)"`
	DataType             *string `json:"data_type" validate:"omitempty,oneof=real virtual" description:"流量类型 (real:真流量, virtual:虚流量)"`
	RealDataMB           *int64  `json:"real_data_mb" validate:"omitempty,min=0" minimum:"0" description:"真流量额度(MB)"`
	VirtualDataMB        *int64  `json:"virtual_data_mb" validate:"omitempty,min=0" minimum:"0" description:"虚流量额度(MB)"`
	DataAmountMB         *int64  `json:"data_amount_mb" validate:"omitempty,min=0" minimum:"0" description:"总流量额度(MB)"`
	Price                int64   `json:"price" validate:"required,min=0" required:"true" minimum:"0" description:"套餐价格(分)"`
	SuggestedCostPrice   *int64  `json:"suggested_cost_price" validate:"omitempty,min=0" minimum:"0" description:"建议成本价(分)"`
	SuggestedRetailPrice *int64  `json:"suggested_retail_price" validate:"omitempty,min=0" minimum:"0" description:"建议售价(分)"`
}

// UpdatePackageRequest 更新套餐请求
type UpdatePackageRequest struct {
	PackageName          *string `json:"package_name" validate:"omitempty,min=1,max=255" minLength:"1" maxLength:"255" description:"套餐名称"`
	SeriesID             *uint   `json:"series_id" validate:"omitempty" description:"套餐系列ID"`
	PackageType          *string `json:"package_type" validate:"omitempty,oneof=formal addon" description:"套餐类型 (formal:正式套餐, addon:附加套餐)"`
	DurationMonths       *int    `json:"duration_months" validate:"omitempty,min=1,max=120" minimum:"1" maximum:"120" description:"套餐时长(月数)"`
	DataType             *string `json:"data_type" validate:"omitempty,oneof=real virtual" description:"流量类型 (real:真流量, virtual:虚流量)"`
	RealDataMB           *int64  `json:"real_data_mb" validate:"omitempty,min=0" minimum:"0" description:"真流量额度(MB)"`
	VirtualDataMB        *int64  `json:"virtual_data_mb" validate:"omitempty,min=0" minimum:"0" description:"虚流量额度(MB)"`
	DataAmountMB         *int64  `json:"data_amount_mb" validate:"omitempty,min=0" minimum:"0" description:"总流量额度(MB)"`
	Price                *int64  `json:"price" validate:"omitempty,min=0" minimum:"0" description:"套餐价格(分)"`
	SuggestedCostPrice   *int64  `json:"suggested_cost_price" validate:"omitempty,min=0" minimum:"0" description:"建议成本价(分)"`
	SuggestedRetailPrice *int64  `json:"suggested_retail_price" validate:"omitempty,min=0" minimum:"0" description:"建议售价(分)"`
}

// PackageListRequest 套餐列表请求
type PackageListRequest 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:"每页数量"`
	PackageName *string `json:"package_name" query:"package_name" validate:"omitempty,max=255" maxLength:"255" description:"套餐名称（模糊搜索）"`
	SeriesID    *uint   `json:"series_id" query:"series_id" validate:"omitempty" description:"套餐系列ID"`
	Status      *int    `json:"status" query:"status" validate:"omitempty,oneof=1 2" description:"状态 (1:启用, 2:禁用)"`
	ShelfStatus *int    `json:"shelf_status" query:"shelf_status" validate:"omitempty,oneof=1 2" description:"上架状态 (1:上架, 2:下架)"`
	PackageType *string `json:"package_type" query:"package_type" validate:"omitempty,oneof=formal addon" description:"套餐类型 (formal:正式套餐, addon:附加套餐)"`
}

// UpdatePackageStatusRequest 更新套餐状态请求
type UpdatePackageStatusRequest struct {
	Status int `json:"status" validate:"required,oneof=1 2" required:"true" description:"状态 (1:启用, 2:禁用)"`
}

// UpdatePackageShelfStatusRequest 更新套餐上架状态请求
type UpdatePackageShelfStatusRequest struct {
	ShelfStatus int `json:"shelf_status" validate:"required,oneof=1 2" required:"true" description:"上架状态 (1:上架, 2:下架)"`
}

// CommissionTierInfo 返佣梯度信息
type CommissionTierInfo struct {
	CurrentRate   string `json:"current_rate" description:"当前返佣比例"`
	NextThreshold *int64 `json:"next_threshold,omitempty" description:"下一档位阈值"`
	NextRate      string `json:"next_rate,omitempty" description:"下一档位返佣比例"`
}

// PackageResponse 套餐响应
type PackageResponse struct {
	ID                    uint                `json:"id" description:"套餐ID"`
	PackageCode           string              `json:"package_code" description:"套餐编码"`
	PackageName           string              `json:"package_name" description:"套餐名称"`
	SeriesID              *uint               `json:"series_id" description:"套餐系列ID"`
	SeriesName            *string             `json:"series_name" description:"套餐系列名称"`
	PackageType           string              `json:"package_type" description:"套餐类型 (formal:正式套餐, addon:附加套餐)"`
	DurationMonths        int                 `json:"duration_months" description:"套餐时长(月数)"`
	DataType              string              `json:"data_type" description:"流量类型 (real:真流量, virtual:虚流量)"`
	RealDataMB            int64               `json:"real_data_mb" description:"真流量额度(MB)"`
	VirtualDataMB         int64               `json:"virtual_data_mb" description:"虚流量额度(MB)"`
	DataAmountMB          int64               `json:"data_amount_mb" description:"总流量额度(MB)"`
	Price                 int64               `json:"price" description:"套餐价格(分)"`
	SuggestedCostPrice    int64               `json:"suggested_cost_price" description:"建议成本价(分)"`
	SuggestedRetailPrice  int64               `json:"suggested_retail_price" description:"建议售价(分)"`
	Status                int                 `json:"status" description:"状态 (1:启用, 2:禁用)"`
	ShelfStatus           int                 `json:"shelf_status" description:"上架状态 (1:上架, 2:下架)"`
	CreatedAt             string              `json:"created_at" description:"创建时间"`
	UpdatedAt             string              `json:"updated_at" description:"更新时间"`
	CostPrice             *int64              `json:"cost_price,omitempty" description:"成本价（分，仅代理用户可见）"`
	ProfitMargin          *int64              `json:"profit_margin,omitempty" description:"利润空间（分，仅代理用户可见）"`
	CurrentCommissionRate string              `json:"current_commission_rate,omitempty" description:"当前返佣比例（仅代理用户可见）"`
	TierInfo              *CommissionTierInfo `json:"tier_info,omitempty" description:"梯度返佣信息（仅代理用户可见）"`
}

// UpdatePackageParams 更新套餐聚合参数
type UpdatePackageParams struct {
	IDReq
	UpdatePackageRequest
}

// UpdatePackageStatusParams 更新套餐状态聚合参数
type UpdatePackageStatusParams struct {
	IDReq
	UpdatePackageStatusRequest
}

// UpdatePackageShelfStatusParams 更新套餐上架状态聚合参数
type UpdatePackageShelfStatusParams struct {
	IDReq
	UpdatePackageShelfStatusRequest
}

// PackagePageResult 套餐分页结果
type PackagePageResult struct {
	List       []*PackageResponse `json:"list" description:"套餐列表"`
	Total      int64              `json:"total" description:"总数"`
	Page       int                `json:"page" description:"当前页"`
	PageSize   int                `json:"page_size" description:"每页数量"`
	TotalPages int                `json:"total_pages" description:"总页数"`
}
