package dto

// CreateAgentRechargeRequest 创建代理充值请求
type CreateAgentRechargeRequest struct {
	ShopID            uint     `json:"shop_id" validate:"required" required:"true" description:"目标店铺ID，代理只能填自己店铺"`
	Amount            int64    `json:"amount" validate:"required,min=1,max=100000000" required:"true" minimum:"1" maximum:"100000000" description:"充值金额（分），范围1分~100万元"`
	PaymentMethod     string   `json:"payment_method" validate:"required,oneof=wechat offline" required:"true" description:"支付方式 (wechat:微信在线支付, offline:线下转账仅平台可用)"`
	PaymentVoucherKey []string `json:"payment_voucher_key" validate:"omitempty,max=5,dive,max=500" maxItems:"5" description:"支付凭证对象存储Key列表（payment_method=offline 时至少1个，最多5个，微信支付时忽略）"`
	Remark            string   `json:"remark" validate:"omitempty,max=1000" maxLength:"1000" description:"运营备注（可选，创建后只读）"`
}

// AgentOfflinePayRequest 代理线下充值确认请求
type AgentOfflinePayRequest struct {
	OperationPassword string `json:"operation_password" validate:"required" required:"true" description:"操作密码"`
}

// AgentOfflinePayParams 确认线下充值聚合参数 (用于文档生成)
type AgentOfflinePayParams struct {
	IDReq
	AgentOfflinePayRequest
}

// AgentRechargeResponse 代理充值记录响应
type AgentRechargeResponse struct {
	ID                   uint     `json:"id" description:"充值记录ID"`
	RechargeNo           string   `json:"recharge_no" description:"充值单号(ARCH前缀)"`
	ShopID               uint     `json:"shop_id" description:"店铺ID"`
	ShopName             string   `json:"shop_name" description:"店铺名称"`
	AgentWalletID        uint     `json:"agent_wallet_id" description:"代理钱包ID"`
	Amount               int64    `json:"amount" description:"充值金额（分）"`
	PaymentMethod        string   `json:"payment_method" description:"支付方式 (wechat:微信在线支付, offline:线下转账)"`
	PaymentChannel       string   `json:"payment_channel" description:"实际支付通道 (wechat_direct:微信直连, fuyou:富友, offline:线下转账)"`
	PaymentConfigID      *uint    `json:"payment_config_id" description:"关联支付配置ID，线下充值为null"`
	PaymentTransactionID string   `json:"payment_transaction_id" description:"第三方支付流水号"`
	PaymentVoucherKey    []string `json:"payment_voucher_key" description:"支付凭证对象存储Key列表（线下支付时存在，最多5个）"`
	Remark               string   `json:"remark,omitempty" description:"运营备注"`
	Status               int      `json:"status" description:"状态 (1:待支付, 2:已支付, 3:已完成, 4:已关闭, 5:已退款, 6:已驳回)"`
	StatusName           string   `json:"status_name" description:"状态名称（中文）"`
	RejectionReason      *string  `json:"rejection_reason,omitempty" description:"驳回原因，仅 status=6 时有值"`
	SubmitterID          uint     `json:"submitter_id" description:"提交人账号ID"`
	SubmitterName        string   `json:"submitter_name" description:"提交人账号名称"`
	ApprovalInstanceID   *uint    `json:"approval_instance_id,omitempty" description:"通用审批实例ID，在线充值为null"`
	ApprovalProvider     string   `json:"approval_provider,omitempty" description:"审批渠道，企微审批为wecom"`
	ApprovalStatus       *int     `json:"approval_status,omitempty" description:"审批状态 (0:提交中, 1:审批中, 2:已通过, 3:已拒绝, 4:已撤销, 5:通过后撤销, 6:已删除, 7:提交失败, 8:提交结果未知)"`
	ApprovalStatusName   string   `json:"approval_status_name,omitempty" description:"审批状态名称（中文）"`
	PaidAt               *string  `json:"paid_at" description:"支付时间"`
	CompletedAt          *string  `json:"completed_at" description:"完成时间"`
	CreatedAt            string   `json:"created_at" description:"创建时间"`
	UpdatedAt            string   `json:"updated_at" description:"更新时间"`
}

// AgentRechargeRejectRequest 驳回代理充值订单请求
type AgentRechargeRejectRequest struct {
	RejectionReason string `json:"rejection_reason" validate:"required,max=500" required:"true" description:"驳回原因（必填，最多500字）"`
}

// AgentRechargeRejectParams 驳回代理充值订单聚合参数（用于文档生成）
type AgentRechargeRejectParams struct {
	IDReq
	AgentRechargeRejectRequest
}

// AgentRechargeListRequest 代理充值记录列表请求
type AgentRechargeListRequest struct {
	Page      int    `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码，默认1"`
	PageSize  int    `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页条数，默认20，最大100"`
	ShopID    *uint  `json:"shop_id" query:"shop_id" description:"按店铺ID过滤"`
	Status    *int   `json:"status" query:"status" description:"按状态过滤 (1:待支付, 2:已支付, 3:已完成, 4:已关闭, 5:已退款, 6:已驳回)"`
	StartDate string `json:"start_date" query:"start_date" description:"创建时间起始日期(YYYY-MM-DD)"`
	EndDate   string `json:"end_date" query:"end_date" description:"创建时间截止日期(YYYY-MM-DD)"`
}

// AgentRechargeListResponse 代理充值记录列表响应
type AgentRechargeListResponse struct {
	Total    int64                    `json:"total" description:"总记录数"`
	Page     int                      `json:"page" description:"当前页码"`
	PageSize int                      `json:"size" description:"每页条数"`
	List     []*AgentRechargeResponse `json:"items" description:"充值记录列表"`
}
