package dto

// WithdrawalRequestListReq 提现申请列表查询请求
type WithdrawalRequestListReq 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）"`
	Status       *int   `json:"status" query:"status" validate:"omitempty,min=1,max=4" minimum:"1" maximum:"4" description:"状态 (1:待审核, 2:已通过, 3:已拒绝, 4:已到账)"`
	WithdrawalNo string `json:"withdrawal_no" query:"withdrawal_no" validate:"omitempty,max=50" maxLength:"50" description:"提现单号（精确查询）"`
	ShopName     string `json:"shop_name" query:"shop_name" validate:"omitempty,max=100" maxLength:"100" description:"店铺名称（模糊查询）"`
	StartTime    string `json:"start_time" query:"start_time" validate:"omitempty" description:"申请开始时间（格式：2006-01-02 15:04:05）"`
	EndTime      string `json:"end_time" query:"end_time" validate:"omitempty" description:"申请结束时间（格式：2006-01-02 15:04:05）"`
}

// WithdrawalRequestItem 提现申请列表项
type WithdrawalRequestItem struct {
	ID               uint   `json:"id" description:"提现申请ID"`
	WithdrawalNo     string `json:"withdrawal_no" description:"提现单号"`
	Amount           int64  `json:"amount" description:"提现金额（分）"`
	FeeRate          int64  `json:"fee_rate" description:"手续费比率（基点，100=1%）"`
	Fee              int64  `json:"fee" description:"手续费（分）"`
	ActualAmount     int64  `json:"actual_amount" description:"实际到账金额（分）"`
	Status           int    `json:"status" description:"状态 (1:待审核, 2:已通过, 3:已拒绝, 4:已到账)"`
	StatusName       string `json:"status_name" description:"状态名称"`
	ShopID           uint   `json:"shop_id" description:"店铺ID"`
	ShopName         string `json:"shop_name" description:"店铺名称"`
	ShopHierarchy    string `json:"shop_hierarchy" description:"店铺层级路径"`
	ApplicantID      uint   `json:"applicant_id" description:"申请人账号ID"`
	ApplicantName    string `json:"applicant_name" description:"申请人用户名"`
	ProcessorID      *uint  `json:"processor_id,omitempty" description:"处理人账号ID"`
	ProcessorName    string `json:"processor_name,omitempty" description:"处理人用户名"`
	WithdrawalMethod string `json:"withdrawal_method" description:"提现方式 (alipay:支付宝, wechat:微信, bank:银行卡)"`
	PaymentType      string `json:"payment_type" description:"放款类型 (manual:人工打款)"`
	AccountName      string `json:"account_name" description:"收款账户名称"`
	AccountNumber    string `json:"account_number" description:"收款账号"`
	BankName         string `json:"bank_name,omitempty" description:"银行名称"`
	RejectReason     string `json:"reject_reason,omitempty" description:"拒绝原因"`
	Remark           string `json:"remark,omitempty" description:"备注"`
	CreatedAt        string `json:"created_at" description:"申请时间"`
	ProcessedAt      string `json:"processed_at,omitempty" description:"处理时间"`
}

// WithdrawalRequestPageResult 提现申请列表分页响应
type WithdrawalRequestPageResult struct {
	Items []WithdrawalRequestItem `json:"items" description:"提现申请列表"`
	Total int64                   `json:"total" description:"总记录数"`
	Page  int                     `json:"page" description:"当前页码"`
	Size  int                     `json:"size" description:"每页数量"`
}

// ApproveWithdrawalReq 审批通过提现申请请求
type ApproveWithdrawalReq struct {
	ID               uint    `json:"-" params:"id" path:"id" validate:"required" description:"提现申请ID"`
	PaymentType      string  `json:"payment_type" validate:"required,oneof=manual" required:"true" description:"放款类型（目前只支持manual人工打款）"`
	Amount           *int64  `json:"amount" validate:"omitempty,min=1" minimum:"1" description:"修正后的提现金额（分），不填则使用原金额"`
	WithdrawalMethod *string `json:"withdrawal_method" validate:"omitempty,oneof=alipay wechat bank" description:"修正后的收款类型 (alipay:支付宝, wechat:微信, bank:银行卡)"`
	AccountName      *string `json:"account_name" validate:"omitempty,max=100" maxLength:"100" description:"修正后的收款人姓名"`
	AccountNumber    *string `json:"account_number" validate:"omitempty,max=100" maxLength:"100" description:"修正后的收款账号"`
	Remark           string  `json:"remark" validate:"omitempty,max=500" maxLength:"500" description:"备注"`
}

// RejectWithdrawalReq 拒绝提现申请请求
type RejectWithdrawalReq struct {
	ID     uint   `json:"-" params:"id" path:"id" validate:"required" description:"提现申请ID"`
	Remark string `json:"remark" validate:"required,max=500" required:"true" maxLength:"500" description:"拒绝原因（必填）"`
}

// WithdrawalApprovalResp 审批响应
type WithdrawalApprovalResp struct {
	ID           uint   `json:"id" description:"提现申请ID"`
	WithdrawalNo string `json:"withdrawal_no" description:"提现单号"`
	Status       int    `json:"status" description:"状态 (1:待审核, 2:已通过, 3:已拒绝, 4:已到账)"`
	StatusName   string `json:"status_name" description:"状态名称"`
	ProcessedAt  string `json:"processed_at" description:"处理时间"`
}
