import { DefaulResponsePagination, DefaultRequestPagination } from "@/entities/common/model/types";
import { AdditionalServiceCategory, ExtensionRequestParams, FilterProps } from "../types";

// ========================================
// 키인결제 관련 타입들
// ========================================
export enum KeyInPaymentTansactionType {
  ALL = 'ALL',
  APPROVAL = 'APPROVAL',
  FULL_CANCEL = 'FULL_CANCEL',
  PARTIAL_CANCEL = 'PARTIAL_CANCEL'
}

export enum KeyInPaymentStatus {
  ALL = 'ALL',
  REGISTRED = 'REGISTRED',
  WAITING = 'WAITING',
  PROCESSING = 'PROCESSING',
  COMPLETED = 'COMPLETED'
}

export interface KeyInPaymentListItem {
  transactionDate?: string;
  transactionTime?: string;
  customerName?: string;
  transactionCode?: string;
  tid?: string;
  amount?: number;
  statusLabel?: string;
  transactionType?: string;
}

export interface KeyInPaymentListProps {
  additionalServiceCategory: AdditionalServiceCategory;
  listItems: Array<KeyInPaymentListItem>;
  mid?: string;
}

export interface KeyInPaymentFilterProps extends FilterProps {
  mid: string,
  startDate: string;
  endDate: string;
  transactionStatus: KeyInPaymentTansactionType;
  minAmount?: number;
  maxAmount?: number;
  setMid: (mid: string) => void;
  setStartDate: (startDate: string) => void;
  setEndDate: (endDate: string) => void;
  setTransactionStatus: (transactionStatus: KeyInPaymentTansactionType) => void;
  setMinAmount: (minAmount?: number) => void;
  setMaxAmount: (maxAmount?: number) => void;
}

// KEY-IN 결제 확장 서비스
// ========================================
export interface ExtensionKeyinListParams extends ExtensionRequestParams {
  startDate: string;
  endDate: string;
  transactionType: string;
  status: string;
  minAmount?: number;
  maxAmount?: number;
  page?: DefaultRequestPagination;
}

export interface ExtensionKeyinListItemProps {
  transactionDate: string;
  transactionTime: string;
  customerName: string;
  transactionCode: string;
  tid: string;
  amount: number;
  statusLabel: string;
  transactionType: string;
  status: string;
}

export interface ExtensionKeyinListResponse extends DefaulResponsePagination {
  content: Array<ExtensionKeyinListItemProps>
}

export interface ExtensionKeyinDownloadExcelParams extends ExtensionRequestParams {
  fromDate?: string;
  toDate?: string;
  paymentStatus?: string;
  minAmount?: number;
  maxAmount?: number;
}

export interface ExtensionKeyinDownloadExcelResponse {
  status: boolean
}

export interface ExtensionKeyinApplyParams extends ExtensionRequestParams {
  cardNo: string;
  cardExpire: string;
  instmnt: string;
  amount: number;
  productName: string;
  orderNumber: string;
  customerName: string;
  phoneNumber: string;
  email: string;
}

export interface ExtensionKeyinApplyResponse {
  status: boolean;
  data?: {
    tid?: string | null;
    approvalNumber?: string | null;
    approvalDateTime?: string | null;
    resultCode?: string;
    resultMessage?: string;
    cardName?: string | null;
    cardCode?: string | null;
    amount?: number | null;
    installmentMonth?: string | null;
    merchantNumber?: string | null;
    acquirerCode?: string | null;
    acquirerName?: string | null;
    slipNumber?: string | null;
    success?: boolean;
  }
  error?: {
    root?: string;
    errKey?: string;
    code?: string;
    resultMessage?: string;
    timestamp?: string;
    details?: {
      path?: string;
    };
  };
}