import { DefaulResponsePagination, DefaultRequestPagination } from '@/entities/common/model/types';

export enum SettlementTabKeys {
  Calendar = 'calendar',
  List = 'list'
};
export enum InfoWrapKeys {
  Amount = 'Amount',
  Settlement = 'Settlement',
  Transaction = 'Transaction'
};
export interface SettlementTabProps {
  activeTab: SettlementTabKeys
};
export enum SettlementPeriodType {
  SETTLEMENT_DATE = 'SETTLEMENT_DATE',
  TRANSACTION_DATE = 'TRANSACTION_DATE',
};
export enum SettlementPaymentMethod {
  ALL = 'ALL',
  CREDIT_CARD = 'CREDIT_CARD',
  VIRTUAL_ACCOUNT = 'VIRTUAL_ACCOUNT',
  ACCOUNT_TRANSFER = 'ACCOUNT_TRANSFER',
  ACCOUNT_EASY_PAY = 'ACCOUNT_EASY_PAY',
  MOBILE_PAYMENT = 'MOBILE_PAYMENT',
  SSG_MONEY = 'SSG_MONEY',
  SSG_BANK_ACCOUNT = 'SSG_BANK_ACCOUNT',
  CULTURE_VOUCHER = 'CULTURE_VOUCHER',
  TMONEY_PAY = 'TMONEY_PAY',
};

export enum SettlementStatus {
  COMPLETED = 'COMPLETED',
  SCHEDULED = 'SCHEDULED'
};
export interface SettlementsTransactionSummaryParams {
  mid: string;
  periodType: SettlementPeriodType;
  startDate: string;
  endDate: string;
  paymentMethod: SettlementPaymentMethod;
  page: DefaultRequestPagination
};
export interface SettlementsTransactionSummaryResponse {
  settlementAmount?: number;
  transactionAmount?: number;
  paymentFeeAmount?: number;
  escrowFeeAmount?: number;
  authFeeAmount?: number;
  vatAmount?: number;
  preSettlementCancelOffset?: number;
};
export interface SettlementsTransactionListParams {
  mid: string;
  periodType: SettlementPeriodType;
  startDate: string;
  endDate: string;
  paymentMethod: SettlementPaymentMethod;
  page: DefaultRequestPagination;
};
export interface SettlementsTransactionListResponse extends DefaulResponsePagination {
  content: Array<SettlementsTransactionListContent>;
};
export interface SettlementsTransactionListContent {
  approvalNumber?: string;
  mid?: string;
  tid?: string;
  approvalDate?: string;
  settlementDate?: string;
  transactionAmount?: number;
};
export interface SettlementsTransactionDetailParams {
  tid: string;
};
export interface SettlementsTransactionDetailResponse {
  transactionAmount: number;
  merchantName: string;
  amountInfo: AmountInfo;
  transactionInfo: TransactionInfo;
};
export interface AmountInfo {
  totalTransactionAmount?: number;
  totalTransactionCount?: number;
  creditCardAmount?: number;
  creditCardCount?: number;
  accountTransferAmount?: number;
  accountTransferCount?: number;
  totalPgFee?: number;
  paymentFee?: number;
  escrowFee?: number;
  authFee?: number;
  vatFee?: number;
  holdAmount?: number;
  releaseAmount?: number;
  offsetAmount?: number;

  transactionAmount?: number;
  settlementAmount?: number;
  preSettlementCancelOffset?: number;
  finalSettlementAmount?: number;
};
export interface TransactionInfo {
  orderNumber: string;
  tid: string;
  originalTid: string;
  transactionStatus: string;
  paymentMethod: string;
  settlementDate: string;
  approvalDate: string;
  cancelDate: string;
  cardCompany: string;
  approvalNumber: string;
  productName: string;
  buyerName: string;
};
export interface SettlementsHistoryParams {
  mid: string;
  periodType: SettlementPeriodType;
  startDate: string;
  endDate: string;
  paymentMethod: SettlementPaymentMethod;
  page: DefaultRequestPagination
};
export interface SettlementsHistoryResponse extends DefaulResponsePagination {
  content: Array<SettlementsHistoryContent>;
};
export interface SettlementsHistoryContent {
  settlementId?: string;
  settlementDate?: string;
  merchantName?: string;
  mid?: string;
  settlementAmount?: number;
};
export interface SettlementsHistorySummaryParams {
  mid: string;
  periodType: SettlementPeriodType;
  startDate: string;
  endDate: string;
  paymentMethod: SettlementPaymentMethod;
};
export interface SettlementsHistorySummaryResponse {
  settlementAmount?: number;
  transactionAmount?: number;
  pgFeeAmount?: number;
  holdAmount?: number;
  releaseAmount?: number;
  offsetAmount?: number;
};
export interface SettlementsHistoryDetailParams {
  settlementId: string;
};
export interface SettlementsHistoryDetailResponse {
  settlementAmount: number;
  settlementDate: string;
  amountInfo: AmountInfo;
  settlementInfo: SettlementInfo;
};
export interface SettlementInfo {
  mid: string;
  transferStatus: string;
  transferId: string;
  transferTime: string;
  bankName: string;
  accountNumber: number;
  depositorName: string;
  settlementDepositAmount: number;
  errorReason: string;
};
export interface SettlementsCalendarParams {
  mid: string;
  yearMonth: string;
};
export interface SettlementsCalendarResponse {
  yearMonth: string;
  totalCompletedAmount: number;
  totalScheduledAmount: number;
  settlementDays: Array<SettlementDays>;
};
export interface SettlementDays {
  settlementDate: string;
  completedAmount: number;
  scheduledAmount: number;
  settlementStatus: SettlementStatus;
};
export interface ListDateGroupProps {
  date?: string;
  periodType: SettlementPeriodType;
  items?: Array<SettlementsHistoryContent & SettlementsTransactionListContent>
};
export interface ListItemProps extends SettlementsHistoryContent, SettlementsTransactionListContent {
  periodType: SettlementPeriodType;
};

export interface AmountInfoWrapProps {
  periodType: SettlementPeriodType;
  amountInfo?: AmountInfo;
  settlementAmount?: number | null;
};
export interface SettlementInfoWrapProps {
  settlementInfo?: SettlementInfo;
  isOpen: boolean;
  onClickToShowInfo: (infoWrapKey: InfoWrapKeys) => void;
};
export interface TransactionInfoWrapProps {
  transactionInfo?: TransactionInfo;
  isOpen: boolean;
  onClickToShowInfo: (infoWrapKey: InfoWrapKeys) => void;
};