import type { BaseResponse } from './common'

export type BulkPurchasePaymentMethod = 'wallet' | 'offline'

export enum BulkPurchaseTaskStatus {
  PENDING = 1,
  PROCESSING = 2,
  COMPLETED = 3,
  FAILED = 4,
  CANCELED = 5
}

export interface BulkPurchaseCreateResponse {
  task_id: number
  task_no?: string
  status?: BulkPurchaseTaskStatus
  status_name?: string
  message?: string
}

export interface BulkPurchaseTask {
  id?: number
  task_id: number
  task_no?: string
  status: BulkPurchaseTaskStatus
  status_name?: string
  total_count?: number
  success_count?: number
  failed_count?: number
  total_amount?: number
  success_amount?: number
  failed_amount?: number
  amount_summary?: Record<string, number | string>
  error_code?: string
  error_summary?: string
  created_at?: string
  updated_at?: string
  started_at?: string
  completed_at?: string
}

export interface BulkPurchaseItem {
  id?: number
  row_number?: number
  line?: number
  asset_identifier?: string
  iccid?: string
  virtual_no?: string
  package_code?: string
  status?: string | number
  status_name?: string
  error_code?: string
  error_reason?: string
  error_summary?: string
}

export interface BulkPurchaseItemsResponse {
  items: BulkPurchaseItem[]
  page?: number
  size?: number
  page_size?: number
  total?: number
}

export type BulkPurchaseCreateApiResponse = BaseResponse<BulkPurchaseCreateResponse>
export type BulkPurchaseTaskApiResponse = BaseResponse<BulkPurchaseTask>
export type BulkPurchaseItemsApiResponse = BaseResponse<BulkPurchaseItemsResponse>
