package mysql

type giftMetadata struct {
	AppCode          string   `json:"app_code"`
	GiftID           string   `json:"gift_id"`
	GiftName         string   `json:"gift_name"`
	GiftIconURL      string   `json:"gift_icon_url"`
	GiftAnimationURL string   `json:"gift_animation_url"`
	GiftEffectTypes  []string `json:"gift_effect_types"`
	ResourceID       int64    `json:"resource_id"`
	ResourceSnapshot string   `json:"resource_snapshot_json"`
	GiftTypeCode     string   `json:"gift_type_code"`
	CPRelationType   string   `json:"cp_relation_type"`
	PresentationJSON string   `json:"presentation_json"`
	SortOrder        int32    `json:"sort_order"`
	GiftCount        int32    `json:"gift_count"`
	PriceVersion     string   `json:"price_version"`
	CoinPrice        int64    `json:"coin_price"`
	// GiftPointAmount 是历史礼物积分单价字段，新送礼固定写 0，业务统计只读真实扣费和热度。
	GiftPointAmount int64  `json:"gift_point_amount"`
	HeatUnitValue   int64  `json:"heat_unit_value"`
	ChargeAssetType string `json:"charge_asset_type"`
	ChargeAmount    int64  `json:"charge_amount"`
	CoinSpent       int64  `json:"coin_spent"`
	// ChargeSource 记录本次送礼从哪里扣费；bag 会扣用户资源库存，但 CoinSpent 仍保留礼物价值用于房间贡献。
	ChargeSource string `json:"charge_source,omitempty"`
	// EntitlementID 只在背包送礼时存在，用于排查某次送礼具体消耗了哪条用户权益。
	EntitlementID string `json:"entitlement_id,omitempty"`
	// GiftPointAdded 是历史收礼积分字段，新送礼固定写 0，保留 JSON 字段只为旧事件解析兼容。
	GiftPointAdded int64 `json:"gift_point_added"`
	HeatValue      int64 `json:"heat_value"`
	BalanceAfter   int64 `json:"balance_after"`
	// BalanceVersion 与 BalanceAfter 一起固化 sender 账后快照；重试不能读取当前账户版本冒充首次结果。
	BalanceVersion          int64  `json:"balance_version,omitempty"`
	GiftIncomeCoinAmount    int64  `json:"gift_income_coin_amount"`
	GiftIncomeRatioPercent  string `json:"gift_income_ratio_percent,omitempty"`
	GiftIncomeRatioRegionID int64  `json:"gift_income_ratio_region_id,omitempty"`
	GiftIncomeBalanceAfter  int64  `json:"gift_income_balance_after,omitempty"`
	// 充值画像只写入幸运礼物真实扣费的交易快照；旧交易没有这些字段时 JSON 解码自然回落为 0，保持回放兼容。
	RechargeSevenDayCoins  int64 `json:"recharge_seven_day_coins,omitempty"`
	RechargeThirtyDayCoins int64 `json:"recharge_thirty_day_coins,omitempty"`
	LastRechargedAtMS      int64 `json:"last_recharged_at_ms,omitempty"`
	// PaidAtMS 与 wallet_transactions.created_at_ms 同源；写进 metadata 让新交易直接重放，
	// 历史 metadata 缺字段时 receipt 查询会从交易主表创建时间补齐。
	PaidAtMS                              int64  `json:"paid_at_ms,omitempty"`
	BillingReceipt                        string `json:"billing_receipt_id"`
	SenderUserID                          int64  `json:"sender_user_id"`
	SenderRegionID                        int64  `json:"sender_region_id"`
	TargetUserID                          int64  `json:"target_user_id"`
	TargetIsHost                          bool   `json:"target_is_host"`
	TargetHostRegionID                    int64  `json:"target_host_region_id"`
	TargetAgencyOwnerUserID               int64  `json:"target_agency_owner_user_id"`
	HostPeriodDiamondAdded                int64  `json:"host_period_diamond_added"`
	HostIncomePolicyType                  string `json:"host_income_policy_type,omitempty"`
	HostIncomeBalanceAfter                int64  `json:"host_income_balance_after,omitempty"`
	IncomeAssetType                       string `json:"income_asset_type,omitempty"`
	HostBaseAmount                        int64  `json:"host_base_amount,omitempty"`
	AgencyAmount                          int64  `json:"agency_amount,omitempty"`
	AgencyIncomeBalanceAfter              int64  `json:"agency_income_balance_after,omitempty"`
	AgencyPointShareBPS                   int32  `json:"agency_point_share_bps,omitempty"`
	GiftDiamondRatioPercent               string `json:"gift_diamond_ratio_percent"`
	GiftDiamondRatioPPM                   int64  `json:"gift_diamond_ratio_ppm,omitempty"`
	GiftDiamondRatioRegionID              int64  `json:"gift_diamond_ratio_region_id"`
	HostSalaryPolicyID                    uint64 `json:"host_salary_policy_id,omitempty"`
	HostSalaryPolicyVersion               uint64 `json:"host_salary_policy_version,omitempty"`
	PointDiamondsPerUSD                   int64  `json:"point_diamonds_per_usd,omitempty"`
	CoinsPerUSD                           int64  `json:"coins_per_usd,omitempty"`
	HostSalaryPolicyDiamondCoefficient    string `json:"host_salary_policy_diamond_coefficient,omitempty"`
	HostSalaryPolicyDiamondCoefficientPPM int64  `json:"host_salary_policy_diamond_coefficient_ppm,omitempty"`
	HostPeriodDiamondAfter                int64  `json:"host_period_diamond_after"`
	HostPeriodDiamondVersion              int64  `json:"host_period_diamond_version"`
	HostPeriodCycleKey                    string `json:"host_period_cycle_key"`
	HostPointAssetType                    string `json:"host_point_asset_type,omitempty"`
	HostPointAdded                        int64  `json:"host_point_added,omitempty"`
	HostPointBalanceAfter                 int64  `json:"host_point_balance_after,omitempty"`
	HostPointPolicyInstanceCode           string `json:"host_point_policy_instance_code,omitempty"`
	HostPointTemplateCode                 string `json:"host_point_template_code,omitempty"`
	HostPointTemplateVersion              string `json:"host_point_template_version,omitempty"`
	RoomID                                string `json:"room_id"`
	RoomRegionID                          int64  `json:"room_region_id"`
	RoomContributionRatioPercent          string `json:"room_contribution_ratio_percent"`
	RoomContributionRatioRegionID         int64  `json:"room_contribution_ratio_region_id"`
	RobotGift                             bool   `json:"robot_gift,omitempty"`
	DirectGift                            bool   `json:"direct_gift,omitempty"`
}

type adminCreditMetadata struct {
	AppCode        string `json:"app_code"`
	TargetUserID   int64  `json:"target_user_id"`
	AssetType      string `json:"asset_type"`
	Amount         int64  `json:"amount"`
	OperatorUserID int64  `json:"operator_user_id"`
	Reason         string `json:"reason"`
	Remark         string `json:"remark"`
	EvidenceRef    string `json:"evidence_ref"`
}

type cpBreakupFeeMetadata struct {
	AppCode          string `json:"app_code"`
	UserID           int64  `json:"user_id"`
	RelationshipID   string `json:"relationship_id"`
	RelationType     string `json:"relation_type"`
	Amount           int64  `json:"amount"`
	CoinBalanceAfter int64  `json:"coin_balance_after"`
}

type wheelDrawDebitMetadata struct {
	AppCode          string `json:"app_code"`
	UserID           int64  `json:"user_id"`
	WheelID          string `json:"wheel_id"`
	DrawCount        int32  `json:"draw_count"`
	Amount           int64  `json:"amount"`
	CoinBalanceAfter int64  `json:"coin_balance_after"`
}

type taskRewardMetadata struct {
	AppCode      string `json:"app_code"`
	TargetUserID int64  `json:"target_user_id"`
	AssetType    string `json:"asset_type"`
	Amount       int64  `json:"amount"`
	TaskType     string `json:"task_type"`
	TaskID       string `json:"task_id"`
	CycleKey     string `json:"cycle_key"`
	Reason       string `json:"reason"`
	BalanceAfter int64  `json:"balance_after"`
	GrantedAtMS  int64  `json:"granted_at_ms"`
}

type luckyGiftRewardMetadata struct {
	AppCode         string `json:"app_code"`
	TargetUserID    int64  `json:"target_user_id"`
	AssetType       string `json:"asset_type"`
	Amount          int64  `json:"amount"`
	DrawID          string `json:"draw_id"`
	RoomID          string `json:"room_id"`
	VisibleRegionID int64  `json:"visible_region_id"`
	CountryID       int64  `json:"country_id"`
	GiftID          string `json:"gift_id"`
	PoolID          string `json:"pool_id"`
	Reason          string `json:"reason"`
	BalanceAfter    int64  `json:"balance_after"`
	GrantedAtMS     int64  `json:"granted_at_ms"`
}

type wheelRewardMetadata struct {
	AppCode         string `json:"app_code"`
	TargetUserID    int64  `json:"target_user_id"`
	AssetType       string `json:"asset_type"`
	Amount          int64  `json:"amount"`
	DrawID          string `json:"draw_id"`
	WheelID         string `json:"wheel_id"`
	SelectedTierID  string `json:"selected_tier_id"`
	VisibleRegionID int64  `json:"visible_region_id"`
	Reason          string `json:"reason"`
	BalanceAfter    int64  `json:"balance_after"`
	GrantedAtMS     int64  `json:"granted_at_ms"`
}

type roomTurnoverRewardMetadata struct {
	AppCode       string `json:"app_code"`
	TargetUserID  int64  `json:"target_user_id"`
	AssetType     string `json:"asset_type"`
	Amount        int64  `json:"amount"`
	SettlementID  string `json:"settlement_id"`
	RoomID        string `json:"room_id"`
	PeriodStartMS int64  `json:"period_start_ms"`
	PeriodEndMS   int64  `json:"period_end_ms"`
	CoinSpent     int64  `json:"coin_spent"`
	TierID        int64  `json:"tier_id"`
	TierCode      string `json:"tier_code"`
	Reason        string `json:"reason"`
	BalanceAfter  int64  `json:"balance_after"`
	GrantedAtMS   int64  `json:"granted_at_ms"`
}

type inviteActivityRewardMetadata struct {
	AppCode      string `json:"app_code"`
	TargetUserID int64  `json:"target_user_id"`
	AssetType    string `json:"asset_type"`
	Amount       int64  `json:"amount"`
	ClaimID      string `json:"claim_id"`
	RewardType   string `json:"reward_type"`
	TierID       int64  `json:"tier_id"`
	TierCode     string `json:"tier_code"`
	CycleKey     string `json:"cycle_key"`
	ReachedValue int64  `json:"reached_value"`
	Reason       string `json:"reason"`
	BalanceAfter int64  `json:"balance_after"`
	GrantedAtMS  int64  `json:"granted_at_ms"`
}

type agencyOpeningRewardMetadata struct {
	AppCode       string `json:"app_code"`
	TargetUserID  int64  `json:"target_user_id"`
	AssetType     string `json:"asset_type"`
	Amount        int64  `json:"amount"`
	ApplicationID string `json:"application_id"`
	CycleID       string `json:"cycle_id"`
	AgencyID      int64  `json:"agency_id"`
	RankNo        int32  `json:"rank_no"`
	ScoreCoins    int64  `json:"score_coins"`
	Reason        string `json:"reason"`
	BalanceAfter  int64  `json:"balance_after"`
	GrantedAtMS   int64  `json:"granted_at_ms"`
}

type gameCoinMetadata struct {
	AppCode         string `json:"app_code"`
	UserID          int64  `json:"user_id"`
	PlatformCode    string `json:"platform_code"`
	GameID          string `json:"game_id"`
	ProviderOrderID string `json:"provider_order_id"`
	ProviderRoundID string `json:"provider_round_id"`
	OpType          string `json:"op_type"`
	AssetType       string `json:"asset_type"`
	CoinAmount      int64  `json:"coin_amount"`
	AvailableDelta  int64  `json:"available_delta"`
	RoomID          string `json:"room_id"`
	BalanceAfter    int64  `json:"balance_after"`
	AppliedAtMS     int64  `json:"applied_at_ms"`
}

type coinSellerTransferMetadata struct {
	AppCode                      string `json:"app_code"`
	PaymentOrderID               string `json:"payment_order_id,omitempty"`
	ProviderCode                 string `json:"provider,omitempty"`
	PaymentMethodID              int64  `json:"payment_method_id,omitempty"`
	SellerUserID                 int64  `json:"seller_user_id"`
	TargetUserID                 int64  `json:"target_user_id"`
	TargetCountryID              int64  `json:"target_country_id"`
	GoogleProductID              string `json:"google_product_id,omitempty"`
	ProductCode                  string `json:"product_code,omitempty"`
	ProductName                  string `json:"product_name,omitempty"`
	SellerRegionID               int64  `json:"seller_region_id"`
	TargetRegionID               int64  `json:"target_region_id"`
	Amount                       int64  `json:"amount"`
	Reason                       string `json:"reason"`
	SellerAssetType              string `json:"seller_asset_type"`
	TargetAssetType              string `json:"target_asset_type"`
	SellerBalanceAfter           int64  `json:"seller_balance_after"`
	TargetBalanceAfter           int64  `json:"target_balance_after"`
	RechargeSequence             int64  `json:"recharge_sequence"`
	RechargeUSDMinor             int64  `json:"recharge_usd_minor"`
	RechargeCurrencyCode         string `json:"recharge_currency_code"`
	RechargePolicyID             int64  `json:"recharge_policy_id"`
	RechargePolicyVersion        string `json:"recharge_policy_version"`
	RechargePolicyCoinAmount     int64  `json:"recharge_policy_coin_amount"`
	RechargePolicyUSDMinorAmount int64  `json:"recharge_policy_usd_minor_amount"`
	RechargeType                 string `json:"recharge_type,omitempty"`
}

type coinSellerSubTransferMetadata struct {
	AppCode            string `json:"app_code"`
	ParentUserID       int64  `json:"parent_user_id"`
	ChildUserID        int64  `json:"child_user_id"`
	RegionID           int64  `json:"region_id"`
	Amount             int64  `json:"amount"`
	Reason             string `json:"reason"`
	AssetType          string `json:"asset_type"`
	ParentBalanceAfter int64  `json:"parent_balance_after"`
	ChildBalanceAfter  int64  `json:"child_balance_after"`
	CreatedAtMS        int64  `json:"created_at_ms"`
}

type salaryExchangeMetadata struct {
	AppCode            string `json:"app_code"`
	UserID             int64  `json:"user_id"`
	SalaryAssetType    string `json:"salary_asset_type"`
	CoinAssetType      string `json:"coin_asset_type"`
	SalaryUSDMinor     int64  `json:"salary_usd_minor"`
	CoinPerUSD         int64  `json:"coin_per_usd"`
	CoinAmount         int64  `json:"coin_amount"`
	SalaryBalanceAfter int64  `json:"salary_balance_after"`
	CoinBalanceAfter   int64  `json:"coin_balance_after"`
	Reason             string `json:"reason"`
	CreatedAtMS        int64  `json:"created_at_ms"`
}

type salaryTransferToCoinSellerMetadata struct {
	AppCode                  string `json:"app_code"`
	SourceUserID             int64  `json:"source_user_id"`
	SellerUserID             int64  `json:"seller_user_id"`
	RegionID                 int64  `json:"region_id"`
	SalaryAssetType          string `json:"salary_asset_type"`
	SellerAssetType          string `json:"seller_asset_type"`
	SalaryUSDMinor           int64  `json:"salary_usd_minor"`
	CoinPerUSD               int64  `json:"coin_per_usd"`
	CoinAmount               int64  `json:"coin_amount"`
	RateMinUSDMinor          int64  `json:"rate_min_usd_minor"`
	RateMaxUSDMinor          int64  `json:"rate_max_usd_minor"`
	SourceSalaryBalanceAfter int64  `json:"source_salary_balance_after"`
	SellerBalanceAfter       int64  `json:"seller_balance_after"`
	Reason                   string `json:"reason"`
	CreatedAtMS              int64  `json:"created_at_ms"`
}

type salaryWithdrawalMetadata struct {
	AppCode                 string `json:"app_code"`
	UserID                  int64  `json:"user_id"`
	SalaryAssetType         string `json:"salary_asset_type"`
	SalaryUSDMinor          int64  `json:"salary_usd_minor"`
	PointFeeAmount          int64  `json:"point_fee_amount,omitempty"`
	PointNetAmount          int64  `json:"point_net_amount,omitempty"`
	PointsPerUSD            int64  `json:"points_per_usd,omitempty"`
	PointWithdrawFeeBPS     int64  `json:"point_withdraw_fee_bps,omitempty"`
	PointPolicyInstanceCode string `json:"point_policy_instance_code,omitempty"`
	GrossUSDMinor           int64  `json:"gross_usd_minor,omitempty"`
	FeeUSDMinor             int64  `json:"fee_usd_minor,omitempty"`
	NetUSDMinor             int64  `json:"net_usd_minor,omitempty"`
	PointPolicyID           uint64 `json:"point_policy_id,omitempty"`
	PointPolicyVersion      uint64 `json:"point_policy_version,omitempty"`
	CoinsPerUSD             int64  `json:"coins_per_usd,omitempty"`
	OperatorUserID          int64  `json:"operator_user_id,omitempty"`
	Reason                  string `json:"reason"`
	WithdrawalRef           string `json:"withdrawal_ref,omitempty"`
	WithdrawalApplicationID string `json:"withdrawal_application_id,omitempty"`
	RegionID                int64  `json:"region_id,omitempty"`
	AvailableAfter          int64  `json:"available_after"`
	FrozenAfter             int64  `json:"frozen_after"`
	Version                 int64  `json:"version"`
	CreatedAtMS             int64  `json:"created_at_ms"`
}

type coinSellerStockMetadata struct {
	AppCode                string `json:"app_code"`
	PaymentOrderID         string `json:"payment_order_id,omitempty"`
	ProviderCode           string `json:"provider,omitempty"`
	PaymentMethodID        int64  `json:"payment_method_id,omitempty"`
	SellerUserID           int64  `json:"seller_user_id"`
	SellerCountryID        int64  `json:"seller_country_id"`
	SellerRegionID         int64  `json:"seller_region_id"`
	StockType              string `json:"stock_type"`
	CoinAmount             int64  `json:"coin_amount"`
	PaidCurrencyCode       string `json:"paid_currency_code"`
	PaidAmountMicro        int64  `json:"paid_amount_micro"`
	PaymentRef             string `json:"payment_ref"`
	EvidenceRef            string `json:"evidence_ref"`
	OperatorUserID         int64  `json:"operator_user_id"`
	Reason                 string `json:"reason"`
	AssetType              string `json:"asset_type"`
	CountsAsSellerRecharge bool   `json:"counts_as_seller_recharge"`
	BalanceAfter           int64  `json:"balance_after"`
	CreatedAtMS            int64  `json:"created_at_ms"`
}
