package dto

// PriceAdjustment 价格调整配置
type PriceAdjustment struct {
	Type  string `json:"type" validate:"required,oneof=fixed percent" required:"true" description:"调整类型 (fixed:固定金额, percent:百分比)"`
	Value int64  `json:"value" validate:"required" required:"true" description:"调整值（分或千分比）"`
}

// BatchAllocatePackagesRequest 批量分配套餐请求
type BatchAllocatePackagesRequest struct {
	ShopID                  uint             `json:"shop_id" validate:"required" required:"true" description:"被分配的店铺ID"`
	SeriesID                uint             `json:"series_id" validate:"required" required:"true" description:"套餐系列ID"`
	PriceAdjustment         *PriceAdjustment `json:"price_adjustment" validate:"omitempty" description:"可选加价配置"`
	OneTimeCommissionAmount *int64           `json:"one_time_commission_amount" validate:"omitempty,min=0" minimum:"0" description:"该代理能拿到的一次性佣金（分）"`
	ExpiryBaseOverride      *string          `json:"expiry_base_override" nullable:"true" description:"分配生效条件覆盖 (null:跟随套餐默认值, from_activation:实名激活时生效, from_purchase:购买即生效)"`
	ExpiryBaseOverrideSet   bool             `json:"-"`
}

// BatchAllocatePackagesResponse 批量分配套餐响应
type BatchAllocatePackagesResponse struct {
	TotalPackages  int                                  `json:"total_packages" description:"总套餐数"`
	AllocatedCount int                                  `json:"allocated_count" description:"成功分配数量"`
	SkippedCount   int                                  `json:"skipped_count" description:"跳过数量（已存在）"`
	Allocations    []ShopPackageAllocationTermsResponse `json:"allocations" description:"本次新建套餐分配及其生效条件"`
}

// UpdateAllocationExpiryBaseRequest 修改套餐分配生效条件覆盖请求。
type UpdateAllocationExpiryBaseRequest struct {
	ExpiryBaseOverride    *string `json:"expiry_base_override" nullable:"true" description:"分配生效条件覆盖 (null:跟随套餐默认值, from_activation:实名激活时生效, from_purchase:购买即生效)"`
	ExpiryBaseOverrideSet bool    `json:"-"`
}

// ShopPackageAllocationTermsResponse 套餐分配计时条款响应。
type ShopPackageAllocationTermsResponse struct {
	ID                      uint    `json:"id" description:"套餐分配ID"`
	DefaultExpiryBase       string  `json:"default_expiry_base" description:"套餐默认生效条件 (from_activation:实名激活时生效, from_purchase:购买即生效)"`
	DefaultExpiryBaseName   string  `json:"default_expiry_base_name" description:"套餐默认生效条件名称（中文）"`
	ExpiryBaseOverride      *string `json:"expiry_base_override" description:"分配生效条件覆盖，null 表示跟随套餐默认值"`
	ExpiryBaseOverrideName  string  `json:"expiry_base_override_name" description:"分配生效条件覆盖名称（中文）"`
	EffectiveExpiryBase     string  `json:"effective_expiry_base" description:"最终生效条件 (from_activation:实名激活时生效, from_purchase:购买即生效)"`
	EffectiveExpiryBaseName string  `json:"effective_expiry_base_name" description:"最终生效条件名称（中文）"`
}

// UpdateAllocationExpiryBaseParams 修改套餐分配生效条件覆盖聚合参数。
type UpdateAllocationExpiryBaseParams struct {
	IDReq
	UpdateAllocationExpiryBaseRequest
}
