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

export enum CancelTabKeys {
  All = 'All',
  Part = 'Part'
};
export enum TransactionCategory {
  AllTransaction = 'AllTransaction',
  CashReceipt = 'CashReceipt',
  Escrow = 'Escrow',
  Billing = 'Billing',
};
export enum InfoSectionKeys {
  Amount = 'Amount',
  Important = 'Important',
  Payment = 'Payment',
  Transaction = 'Transaction',
  Settlement = 'Settlement',
  PartCancel = 'PartCancel',
  Issue = 'Issue',
  Detail = 'Detail',
  Escrow = 'Escrow',
  Merchant = 'Merchant'
};
export enum ProcessStep {
  One = 'One',
  Two = 'Two',
};

export enum AllTransactionMoidTid {
  MOID = 'MOID',
  TID = 'TID'
};
export enum AllTransactionStatusCode {
  ALL = '0',
  APPROVAL = '1',
  CANCEL = '2',
  REFUND = '3'
};
export enum AllTransactionServiceCode {
  ALL = 'ALL',
  CREDIT_CARD = 'CREDIT_CARD',
  VIRTUAL_ACCOUNT = 'VIRTUAL_ACCOUNT',
  ACCOUNT_TRANSFER = 'ACCOUNT_TRANSFER',
  ACCOUNT_SIMPLE_TRANSFER = 'ACCOUNT_SIMPLE_TRANSFER',
  MOBILE_PAYMENT = 'MOBILE_PAYMENT',
  SSGMONEY = 'SSGMONEY',
  SSGBANK = 'SSGBANK',
  CULT = 'CULT',
  TMONEY = 'TMONEY '
};

export enum AllTransactionSearchCl {
  ALL = 'ALL',
  CARD_NO = 'CARD_NO',
  CARD_APPROVAL_NO = 'CARD_APPROVAL_NO',
  BANK_BUYER_NM = 'BANK_BUYER_NM',
  VACCT_NO = 'VACCT_NO',
  VACCT_DEPOSIT_NM = 'VACCT_DEPOSIT_NM',
  TEL_NO = 'TEL_NO',
  SSGMONEY_GIFT_NO = 'SSGMONEY_GIFT_NO',
  SSGBANK_APPROVAL_NO = 'SSGBANK_APPROVAL_NO',
  CMSBANK_USER_ID = 'CMSBANK_USER_ID',
  CULT_USER_ID = 'CULT_USER_ID',
  TMONEY_CARD_NO = 'TMONEY_CARD_NO',
};
export enum CashReceiptPurposeType {
  ALL = 'ALL',
  INCOME_DEDUCTION = 'INCOME_DEDUCTION',
  EXPENSE_PROOF = 'EXPENSE_PROOF',
};
export enum CashReceiptTransactionType {
  ALL = 'ALL',
  APPROVAL = 'APPROVAL',
  CANCEL = 'CANCEL',
};
export enum CashReceiptProcessResult {
  ALL = 'ALL',
  REQUEST = 'REQUEST',
  REQUEST_CANCEL = 'REQUEST_CANCEL',
  REQUEST_COMPLETE = 'REQUEST_COMPLETE',
  ISSUE_COMPLETE = 'ISSUE_COMPLETE',
  REQUEST_FAIL = 'REQUEST_FAIL',
  ISSUE_FAIL = 'ISSUE_FAIL',
};
export enum CashReceiptSearchNumberType {
  APPROVAL_NUMBER = 'APPROVAL_NUMBER',
  ISSUE_NUMBER = 'ISSUE_NUMBER'
};
export enum EscrowSearchType {
  ALL = 'ALL',
  ORDER_NUMBER = 'ORDER_NUMBER',
  TID = 'TID'
};
export enum EscrowDeliveryStatus {
  ALL = 'ALL',
  PAY_COMPLETE = 'PAY_COMPLETE',
  DELIVERY_INSERT = 'DELIVERY_INSERT',
  DELIVERY_COMPLETE = 'DELIVERY_COMPLETE',
  PURCHASE_CONFIRM = 'PURCHASE_CONFIRM',
  PURCHASE_REJECT = 'PURCHASE_REJECT',
  RETURN_PROCESSING = 'RETURN_PROCESSING',
  DEPOSIT_COMPLETE = 'DEPOSIT_COMPLETE'
};
export enum EscrowSettlementStatus {
  ALL = 'ALL',
  CREDIT_CARD = 'CREDIT_CARD',
  REAL_ACCOUNT = 'REAL_ACCOUNT',
  ACCOUNT_TRANSFER = 'ACCOUNT_TRANSFER'
};
export enum BillingSearchType {
  ALL = 'ALL',
  ORDER_NUMBER = 'ORDER_NUMBER',
  TID = 'TID'
};
export enum BillingRequestStatus {
  ALL = 'ALL',
  IN_PROGRESS = 'IN_PROGRESS',
  SUCCESS = 'SUCCESS',
  REQUEST_CANCEL = 'REQUEST_CANCEL'
};
export enum BillingProcessResult {
  ALL = 'ALL',
  SUCCESS = 'SUCCESS',
  FAILURE = 'FAILURE'
};
export enum BillingPaymentMethod {
  ALL = 'ALL',
  CREDIT_CARD = 'CREDIT_CARD',
  VIRTUAL_ACCOUNT = 'VIRTUAL_ACCOUNT',
  MOBILE_PAYMENT = 'MOBILE_PAYMENT'
};

export interface ListItemProps extends AllTransactionListItem, CashReceiptListItem, EscrowListItem, BillingListItem {
  transactionCategory?: TransactionCategory;
};
export interface ListDateGroupProps {
  transactionCategory?: TransactionCategory;
  date?: string;
  items?: Array<ListItemProps>;
};
export interface AllTransactionListProps {
  transactionCategory: TransactionCategory;
  listItems: Array<ListItemProps>;
};
export interface CashReceiptListProps {
  transactionCategory: TransactionCategory;
  listItems: Array<ListItemProps>;
};
export interface EscrowListProps {
  transactionCategory: TransactionCategory;
  listItems: Array<ListItemProps>;
};
export interface BillingListProps {
  transactionCategory: TransactionCategory;
  listItems: Array<ListItemProps>;
};
export interface AllTransactionListItem {
  tid?: string;
  mid?: string;
  transactionDateTime?: string;
  statusCode?: string;
  installmentMonth?: string;
  serviceName?: string;
  serviceCode?: string;
  serviceDetailName?: string;
  goodsAmount?: number;
};
export interface CashReceiptListItem {
  transactionDate?: string;
  transactionTime?: string;
  customerName?: string;
  issueNumber?: string;
  tid?: string;
  approvalNumber?: string;
  amount?: number;
  processResult?: string;
  paymentMethod?: string;
  transactionType?: string;
};
export interface EscrowListItem {
  tid?: string;
  mid?: string;
  transactionDate?: string;
  transactionTime?: string;
  customerName?: string;
  issueNumber?: string;
  transactionAmount?: number;
  deliveryStatus?: EscrowDeliveryStatus;
  serviceCode?: string;
  settlementStatus?: string;
  cancelStatus?: string;
};
export interface BillingListItem extends BillingItem {

};

export interface BillingItem {
  billKey?: string;
  tid?: string;
  orderNumber?: string;
  transactionDate?: string;
  transactionTime?: string;
  transactionAmount?: number;
  requestStatus?: string;
  processResult?: string;
  paymentMethod?: string;
};
export interface AllTransactionListResponse extends DefaulResponsePagination {
  content: Array<ListItemProps>;
};
export interface CashReceiptListResponse extends DefaulResponsePagination {
  content: Array<ListItemProps>;
};
export interface EscrowListResponse extends DefaulResponsePagination {
  content: Array<ListItemProps>;
};
export interface BillingListResponse extends DefaulResponsePagination {
  content: Array<ListItemProps>;
};

export interface AllTransactionListSummaryParams extends AllTransactionListParams {}

export interface AllTransactionListSummaryResponse {
  totalCount: number;
  totalAmount: number;
};
export interface AllTransactionListParams {
  mid?: string;
  moid?: string;
  tid?: string;
  fromDate: string;
  toDate: string;
  statusCode?: string;
  serviceCode?: string;
  minAmount?: number;
  maxAmount?: number;
  dateCl?: string;
  goodsName?: string;
  cardCode?: string;
  bankCode?: string;
  searchCl?: AllTransactionSearchCl;
  searchValue?: string;
  sortType?: SortTypeKeys;
  page?: DefaultRequestPagination;
};

export interface CashReceiptListParams {
  mid?: string;
  startDate?: string;
  endDate?: string;
  purposeType?: CashReceiptPurposeType;
  transactionType?: CashReceiptTransactionType;
  processResult?: CashReceiptProcessResult;
  searchNumberType?: CashReceiptSearchNumberType;
  searchNumber?: string;
  page?: DefaultRequestPagination
};
export interface CashReceiptSummaryParams extends CashReceiptListParams {};

export interface CashReceiptSummaryResponse {
  approvalCount: number;
  approvalAmount: number;
  cancelCount: number;
  cancelAmount: number;
  totalCount: number;
};
export interface CashReceiptReceiptDownloadParams {
  approvalNumber: string;
};
export interface CashReceiptReceiptDownloadResponse {
  issueInfo: IssueInfo;
  merchantInfo: MerchantInfo;
  transactionInfo: TransactionInfo;
  amountInfo: AmountInfo;
  customerInfo: CustomerInfo;
  productInfo: ProductInfo;
};
export interface EscrowListParams {
  mid?: string;
  searchType?: string;
  searchKeyword?: string;
  startDate?: string;
  endDate?: string;
  deliveryStatus?: string;
  settlementStatus?: string;
  minAmount?: number;
  maxAmount?: number;
  page?: DefaultRequestPagination;
};

export interface BillingListParams {
  mid?: string;
  searchType?: string;
  searchKeyword?: string;
  startDate?: string;
  endDate?: string;
  requestStatus?: string;
  processResult?: string;
  paymentMethod?: string;
  minAmount?: number;
  maxAmount?: number;
  page?: DefaultRequestPagination
};

export interface AllTransactionDetailParams {
  serviceCode?: string;
  tid?: string;
};
export interface CashReceiptDetailParams {
  tid?: string;
};
export interface EscrowDetailParams {
  tid?: string;
};
export interface BillingDetailParams {
  tid?: string;
};

export interface AmountInfo {
  mid?: string;
  transactionRequestAmount?: number;
  transactionAmount?: number;
  escrowFee?: number;
  pointAmount?: number;
  couponAmount?: number;
  partServiceCode?: number;
  kakaoDiscountAmount?: number;
  tossDiscountAmount?: number;
  multiPointAmount?: number;
  multiCouponAmount?: number;
  receiptAmount?: number;
  cupDepositAmount?: number;

  customerName?: string;
  amount?: number;
  supplyAmount?: number;
  vat?: number;
  serviceAmount?: number;
  taxFreeAmount?: number;

  approvalNo?: string;
  candNo?: string;
  installmentMonth?: string;
  authentication?: string;
  purchaseCompany?: string;
  approvalVAN?: string;
  approvalPurchase?: string | null;
  approvalRejectCount?: string;
  approvalRepurchaseCount?: string;
  cancelPurchase?: string | null;
  cancelRejectCount?: string;
  cancelRepurchaseCount?: string;
  purchaseVan?: string;
  approvalRequestAmount?: number;
  cardAmount?: number;
  discountType?: string | null;
  discountAmount?: number;
  simplePaymentServiceCode?: string;

  buyerName?: string;
};
export interface ImportantInfo {
  moid?: string;
  tid?: string;
  transactionStatus?: string;
  statusName?: string;
  serviceCode?: string;
  serviceName?: string;
  approvalDate?: string;
  approvalTime?: string;
  transactionDate?: string;
  requestDate?: string;
  cancelDate?: string;
  goodsName?: string;
  
  orderNumber?: string;
  paymentMethod?: string;
  productName?: string;
};
export interface PaymentInfo {
  approvalAcquire?: string;
  approvalReturn?: number;
  approvalReAcquire?: number;
  approvalVAN?: string;
  cancelAcquire?: string;
  cancelReturn?: string;
  cancelReAcquire?: string;
  acquireVAN?: string;
  acquireCompany?: string;
  cardNumber?: string;
  approvalNumber?: string;
  installmentPeriod?: number;
  authentication?: string;
  accountType?: string;
  bankName?: string;
  accountNumber?: string;
  depositBankName?: string;
  depositorName?: string;
  depositDeadline?: string;
  depositDate?: string;
  refundScheduleDate?: string;
  refundBankName?: string;
  refundAccountNumber?: string;
  accountHolder?: string;
  refundCompleteDate?: string;
  partner?: string;
  cpid?: string;
  productCategory?: string;
  phoneNumber?: string;
  customerId?: string;
  giftCardNumber?: string;
  culturelandId?: string;
  paymentAmount?: number;

  approvalNo?: string;
  cardNo?: string;
  installmentMonth?: string;
  purchaseCompany?: string;
  approvalPurchase?: string | null;
  approvalRejectCount?: string;
  approvalRepurchaseCount?: string;
  cancelPurchase?: string | null;
  cancelRejectCount?: string;
  cancelRepurchaseCount?: string;
  purchaseVan?: string;
  approvalRequestAmount?: number;
  cardAmount?: number;
  discountType?: string | null;
  discountAmount?: number;
  simplePaymentServiceCode?: string;

  joinType?: string;
  accountNo?: string;
  escrowFee?: number;

  virtualAccountNo?: string;
  refundAccountNo?: string;
  transactionRequestAmount?: number;
  transactionAmount?: number;
};
export interface TransactionInfo {
  buyerName?: string;
  email?: string;
  buyerEmail?: string;
  buyerTel?: string;
  phoneNumber?: string;
  cancelReason?: string;
  cancelRequestor?: string;
  partialCancel?: string;
  cashReceiptIssue?: string;
  transactionDateTime?: string;
  transactionAmount?: number;
};
export interface SettlementInfo {
  approvalSettlementDate?: string;
  approvalSettlementAmount?: number;
  cancelSettlementDate?: string;
  cancelSettlementAmount?: number;
  /*
  scheduledSettlementDate?: string;
  completedSettlementDate?: string;
  */
};
export interface PartCancelInfo {
  originalTid?: string;
  originalAmount?: number;
  partCancelTid?: string;
  partCancelAmount?: number;
  remainingAmount?: number;
};

export interface IssueInfo {
  approvalNumber?: string;
  issueDate?: string;
  issueTime?: string;
  issueNumber?: string;
  purpose?: string;
  paymentMethod?: string;
  productName?: string;
  processResult?: string;
  transactionType?: CashReceiptTransactionType;
};
export interface CustomerInfo {
  customerName: string;
  customerIdentity: string;
};
export interface ProductInfo {
  productName: string;
};

export interface DetailInfo {
  cancelDate?: string;
  cancelApprovalNumber?: number;
  receiptInfo?: string;
  tid?: string;
  merchantTid?: string;
  subMallName?: string;
  subMallBusinessNumber?: number;
  issueChannel?: string;
  failureReason?: string;
  canDownloadReceipt?: boolean;
};
export interface EscrowInfo {
  deliveryStatus?: string;
  deliveryRegistrationDate?: string;
  deliveryCompleteDate?: string;
  purchaseConfirmDate?: string;
  purchaseRejectReason?: string;
  rejectReason?: string;
  escrowCertNumber?: string;
  deliveryCompany?: string;
  trackingNumber?: number;
  deliveryAddress?: string;
};

export interface BillingInfo {
  billKey: string;
  tid: string;
  orderNumber: string;
  approvalNumber: string;
  approvalDate: string;
  transactionAmount?: number;
  requestStatus: string;
  processResult: string;
  installmentMonth: string;
  productName: string;
  buyerName: string;
};

export interface MerchantInfo {
  companyName?: string;
  gid?: string;
  aid?: string;
}

export interface DetailResponse {
  amount?: number;
  customerName?: string;
  amountDetail?: AmountInfo; 
  amountInfo?: AmountInfo;
  importantInfo?: ImportantInfo;
  paymentInfo?: PaymentInfo;
  transactionInfo?: TransactionInfo;
  settlementInfo?: SettlementInfo;
  partCancelInfo?: PartCancelInfo;
  issueInfo?: IssueInfo;
  detailInfo?: DetailInfo;
  escrowInfo?: EscrowInfo;
  billingInfo?: BillingInfo;
  merchantInfo?: MerchantInfo;
};
export interface BillingDetailResponse extends BillingInfo {

}

export interface InfoSectionProps extends DetailResponse {
  transactionCategory?: TransactionCategory;
  isOpen?: boolean;
  tid?: string;
  serviceCode?: string;
  purposeType?: CashReceiptPurposeType | string;
  onClickToOpenInfo?: (info: InfoSectionKeys) => void;
  canDownloadReceipt?: boolean;
}


export interface DownloadConfirmationParams {
  tid?: string;
};
export interface DownloadConfirmationResponse {

};

export interface DownloadExcelParams {
  tid?: string
};
export interface DownloadExcelResponse {

};
export interface AllTransactionCancelParams{
  tid: string;
  cancelAmount: number;
  cancelPassword: string;
  bankCode: string;
  accountNo: string;
  accountHolder: string;
  supplyAmount: number | null;
  goodsVatAmount: number | null;
  taxFreeAmount: number | null;
  serviceAmount: number | null;
  clientIp?: string;
  partCancelCl: boolean;
  isNpg: boolean;
  serviceCode: string;
};
export interface AllTransactionCancelResponse {
  
};
export interface AllTransactionCancelInfoParams {
  serviceCode: string;
  tid: string;
};
export interface AllTransactionCancelInfoResponse {
  debtPreventionCancelDisplayInfo?: DebtPreventionCancelDisplayInfo | null;
  debtPreventionCancelRequestInfo?: DebtPreventionCancelRequestInfo | null;
  goodsVat: number | null;
  isCompoundTax: boolean;
  isConditionalVatAutoCalcMerchant: boolean;
  isNpg: boolean;
  isVatAutoCalcMerchant: boolean;
  isVatDisplayed: boolean;
  partCancelCl: boolean;
  remainAmount: number;
  serviceAmount: number | null;
  supplyAmount: number | null;
  taxFreeAmount: number | null;
  vatAutoCalcSummary: number;
};
export interface DebtPreventionCancelDisplayInfo {
  isCancel: boolean;
  serviceCode: string;
  approvalDate: string;
  approvalNo: string;
  amount: number;
  totalCancelAmount: number;
  depositRequestAmount: number;
  bankName: string;
  accountNo: string;
  accountName: string;
};

export interface DebtPreventionCancelRequestInfo {
  tid: string;  
  mid: string;
  gid: string;
  aid: string;
  corpNo: string;
  corpName: string;
  serviceCode: string;
  serviceProductCode: string;
  approvalDate: string;
  approvalNo: string;
  goodsAmount: number;
  cancelRequestAmount: number;
  depositRequestAmount: number;
  bankName: string;
  accountNo: string;
  depositName: string;
  hourCount: 0,
  totalCancelCount: number;
  autoTaxCalcCl: string;
  approvalVatMark: string;
};
export interface FilterProps {
  filterOn: boolean;
  setFilterOn: (filterOn: boolean) => void;
};
export interface AllTransactionFilterProps extends FilterProps {
  mid: string;
  fromDate: string;
  toDate: string;
  statusCode: string;
  serviceCode: string;
  minAmount?: number;
  maxAmount?: number;
  cardCode?: string;
  bankCode?: string;
  searchCl?: AllTransactionSearchCl;
  searchValue?: string;
  setMid: (mid: string) => void;
  setMoid: (moid: string) => void;
  setTid: (tid: string) => void;
  setFromDate: (fromDate: string) => void;
  setToDate: (endDate: string) => void;
  setStatusCode: (statusCode: string) => void;
  setServiceCode: (serviceCode: string) => void;
  setMinAmount: (minAmount?: number) => void;
  setMaxAmount: (maxAmount?: number) => void;
  setCardCode: (cardCode: string | undefined) => void;
  setBankCode: (bankCode: string | undefined) => void;
  setSearchCl: (searchCl: AllTransactionSearchCl | undefined) => void;
  setSearchValue: (searchValue: string | undefined) => void;
  serviceCodeOptions?: Array<Record<string, any>>;
};
export interface CashReceiptFilterProps extends FilterProps {
  mid: string;
  startDate: string;
  endDate: string;
  purposeType: CashReceiptPurposeType;
  transactionType: CashReceiptTransactionType;
  processResult: CashReceiptProcessResult;
  searchNumberType: CashReceiptSearchNumberType;
  searchNumber: string;
  setMid: (mid: string) => void;
  setStartDate: (startDate: string) => void;
  setEndDate: (endDate: string) => void;
  setPurposeType: (purposeType: CashReceiptPurposeType) => void;
  setTransactionType: (issueStatus: CashReceiptTransactionType) => void;
  setProcessResult: (processResult: CashReceiptProcessResult) => void;
  setSearchNumberType: (searchNumberType: CashReceiptSearchNumberType) => void;
  setSearchNumber: (searchNumber: string) => void;
};
export interface EscrowFilterProps extends FilterProps {
  mid: string;
  searchType: EscrowSearchType;
  searchKeyword: string;
  startDate: string;
  endDate: string;
  deliveryStatus: EscrowDeliveryStatus;
  settlementStatus: EscrowSettlementStatus;
  minAmount?: number;
  maxAmount?: number;
  setMid: (mid: string) => void;
  setSearchType: (searchType: EscrowSearchType) => void;
  setSearchKeyword: (searchKeyword: string) => void;
  setStartDate: (startDate: string) => void;
  setEndDate: (endDate: string) => void;
  setDeliveryStatus: (deliveryStatus: EscrowDeliveryStatus) => void;
  setSettlementStatus: (settlementStatus: EscrowSettlementStatus) => void;
  setMinAmount: (minAmount?: number) => void;
  setMaxAmount: (maxAmount?: number) => void;
};
export interface BillingFilterProps extends FilterProps {
  mid: string;
  searchType: BillingSearchType;
  searchKeyword: string;
  startDate: string;
  endDate: string;
  requestStatus: BillingRequestStatus;
  processResult: BillingProcessResult;
  paymentMethod: BillingPaymentMethod;
  minAmount?: number;
  maxAmount?: number;
  setMid: (mid: string) => void;
  setSearchType: (searchType: BillingSearchType) => void;
  setSearchKeyword: (searchKeyword: string) => void;
  setStartDate: (startDate: string) => void;
  setEndDate: (endDate: string) => void;
  setRequestStatus: (requestStatus: BillingRequestStatus) => void;
  setProcessResult: (processResult: BillingProcessResult) => void;
  setPaymentMethod: (paymentMethod: BillingPaymentMethod) => void;
  setMinAmount: (minAmount?: number) => void;
  setMaxAmount: (maxAmount?: number) => void;
};

export interface CashReceiptPurposeUpdateParams {
  tid: string;
  newPurpose: string;
};
export interface CashReceiptPurposeUpdateResponse {
  issueNumber: number;
  beforePurposeType: CashReceiptPurposeType;
  afterPurposeType: CashReceiptPurposeType;
  updateDateTime: string;
};
export interface CashReceiptManualIssueParams {
  businessNumber: string,
  purpose: CashReceiptPurposeType
  productName: string,
  buyerName: string,
  issueNumber: string,
  email: string,
  phoneNumber: string,
  supplyAmount: number,
  vatAmount: number,
  taxFreeAmount: number,
  serviceCharge: number
};
export interface CashReceiptManualIssueResponse {
  approvalNumber: number,
  totalAmount: number,
  issueDateTime: string,
  issueResult: SuccessResult
};
export interface BillingChargeParams {
  billKey: string;
  productName: string;
  productAmount: number;
  orderNumber: string;
  buyerName: string;
  paymentRequestDate: string;
  installmentMonth: string;
};
export interface BillingChargeResponse {

};
export interface EscrowMailResendParams {
  orderNumber?: string;
  tid?: string;
};
export interface EscrowMailResendResponse {

};