/**
 * 退款管理相关类型定义
 */

// 退款状态
export enum RefundStatus {
  PENDING = 1, // 待审批
  APPROVED = 2, // 已通过
  REJECTED = 3, // 已拒绝
  RETURNED = 4 // 已退回
}

// 退款申请
export interface Refund {
  id: number
  refund_no: string
  order_id: number
  shop_id: number
  package_usage_id: number | null
  requested_refund_amount: number // 申请退款金额（分）
  approved_refund_amount: number | null // 实际退款金额（分）
  actual_received_amount: number // 实收金额（分）
  status: RefundStatus
  refund_reason: string
  reject_reason: string
  remark: string
  asset_reset: boolean
  commission_deducted: boolean
  creator: number
  processor_id: number | null
  processed_at: string | null
  created_at: string
  updated_at: string
  updater: number
}

// 查询退款申请列表参数
export interface RefundQueryParams {
  page?: number
  page_size?: number
  status?: RefundStatus
  order_id?: number
  shop_id?: number
  dateRange?: string[]
}

// 退款申请列表响应
export interface RefundListResponse {
  items: Refund[]
  page: number
  size: number
  total: number
}

// 创建退款申请请求
export interface CreateRefundRequest {
  order_id: number
  requested_refund_amount: number // 申请退款金额（分）
  actual_received_amount: number // 实收金额（分）
  refund_reason?: string
}

// 审批通过退款申请请求
export interface ApproveRefundRequest {
  approved_refund_amount?: number // 实际退款金额（分）
  remark?: string
}

// 审批拒绝退款申请请求
export interface RejectRefundRequest {
  reject_reason: string
}

// 重新提交退款申请请求
export interface ResubmitRefundRequest {
  requested_refund_amount?: number
  actual_received_amount?: number
  refund_reason?: string
}

// 退回退款申请请求
export interface ReturnRefundRequest {
  remark?: string
}
