import { DefaulResponsePagination, DefaultRequestPagination } from '@/entities/common/model/types';
import { PayoutContent } from './payout/types';
import { FundAccountTransferContentItem, FundAccountResultContentItem } from './fund-account/types';
import { ArsListContent } from './ars/types';
import { AlimtalkListContent } from './alimtalk/types';
import { SmsPaymentListItem } from './sms-payment/types';
import type { ExtensionSmsDetailResponse } from './sms-payment/types';
import { FaceAuthListItem } from './face-auth/types';
import { AccountHolderSearchListItem } from './account-holder-search/types';
import { KeyInPaymentListItem } from './key-in/types';
import { AccountHolderAuthListItem, AccountHolderAuthStatus } from './account-holder-auth/types';
import { LinkContentType, LinkPaymentHistoryListItem, LinkPaymentSendMethod, LinkPaymentWaitListItem } from './link-pay/types';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { PATHS } from '@/shared/constants/paths';

// ========================================
// 공통 Enums 및 타입들
// ========================================
export enum ProcessResult {
  ALL = '',
  SUCCESS = 'SUCCESS',
  FAIL = 'FAIL'
}

// 부가서비스 카테고리 enum
export enum AdditionalServiceCategory {
  KeyInPayment = 'KeyInPayment',
  AccountHolderAuth = 'AccountHolderAuth',
  AccountHolderSearch = 'AccountHolderSearch',
  LinkPaymentHistory = 'LinkPaymentHistory',
  LinkPaymentWait = 'LinkPaymentWait',
  FundAccountTransfer = 'FundAccountTransfer',
  FundAccountResult = 'FundAccountResult',
  SettlementAgency = 'SettlementAgency',
  SMSPayment = 'SMSPayment',
  Payout = 'Payout',
  Ars = 'Ars',
  Alimtalk = 'Alimtalk',
  FaceAuth = 'FaceAuth'
}

export enum IdentityType {
  INDIVIDUAL = "INDIVIDUAL",
  CORPORATE = "CORPORATE"
}

export enum Language {
  KR = "KR",
  EN = "EN"
}

export const SERVICE_MAP = [
  { code: 'SMS', serviceNameKey: 'additionalService.services.sms', serviceDescKey: 'additionalService.services.smsDesc', icon: IMAGE_ROOT + '/icon_ing03.svg', path: PATHS.additionalService.smsPaymentNotification },
  { code: 'ARS', serviceNameKey: 'additionalService.services.ars', serviceDescKey: 'additionalService.services.arsDesc', icon: IMAGE_ROOT + '/icon_ing01.svg', path: PATHS.additionalService.ars.list },
  { code: 'KEYIN', serviceNameKey: 'additionalService.services.keyIn', serviceDescKey: 'additionalService.services.keyInDesc', icon: IMAGE_ROOT + '/icon_ing02.svg', path: PATHS.additionalService.keyInPayment.list },
  { code: 'SEARCH_ACCOUNT_NAME', serviceNameKey: 'additionalService.services.accountHolderSearch', serviceDescKey: 'additionalService.services.accountHolderSearchDesc', icon: IMAGE_ROOT + '/icon_ing04.svg', path: PATHS.additionalService.accountHolderSearch.list },
  { code: 'PAYOUT', serviceNameKey: 'additionalService.services.payout', serviceDescKey: 'additionalService.services.payoutDesc', icon: IMAGE_ROOT + '/icon_ing05.svg', path: PATHS.additionalService.payout.list },
  { code: 'SETTLEMENT', serviceNameKey: 'additionalService.services.settlementAgency', serviceDescKey: 'additionalService.services.settlementAgencyDesc', icon: IMAGE_ROOT + '/icon_ing06.svg', path: PATHS.additionalService.settlementAgency.manage },
  { code: 'LINKPAY', serviceNameKey: 'additionalService.services.linkPayment', serviceDescKey: 'additionalService.services.linkPaymentDesc', icon: IMAGE_ROOT + '/icon_ing07.svg', path: PATHS.additionalService.linkPayment.shippingHistory },
  { code: 'FUND_ACCOUNT', serviceNameKey: 'additionalService.services.fundAccount', serviceDescKey: 'additionalService.services.fundAccountDesc', icon: IMAGE_ROOT + '/icon_ing08.svg', path: PATHS.additionalService.fundAccount.transferList },
  { code: 'ACCOUNT_AUTH', serviceNameKey: 'additionalService.services.accountHolderAuth', serviceDescKey: 'additionalService.services.accountHolderAuthDesc', icon: IMAGE_ROOT + '/icon_ing09.svg', path: PATHS.additionalService.accountHolderAuth.list },
  { code: 'ALIMTALK', serviceNameKey: 'additionalService.services.alimtalk', serviceDescKey: 'additionalService.services.alimtalkDesc', icon: IMAGE_ROOT + '/icon_ing10.svg', path: PATHS.additionalService.alimtalk.list },
  { code: 'FACE_AUTH', serviceNameKey: 'additionalService.services.faceAuth', serviceDescKey: 'additionalService.services.faceAuthDesc', icon: IMAGE_ROOT + '/icon_ing11.svg', path: PATHS.additionalService.faceAuth.list },
];

// ========================================
// 상세정보 Interface
// ========================================

export interface TitleInfo {
  amount?: number,
  corpName?: string,
  accountNo?: string,
  accountName?: string,
  authDate?: string,
  bankName?: string,
  requestDate?: string,
  sendDate?: string,
  scheduledSendDate?: string
}

export interface DetailInfo {
  accountName?: string; // 예금주
  requestDate?: string; // 조회 일시
  resultStatus?: string; // 결과
  authDate?: string;
  bankName?: string; // 은행 명
  failureReason?: string; // 실패사유
  accountNo?: string; // 계좌번호
  requestWay?: string; //요청 구분
  authStatus?: string;
  authResult?: string;

  mid?: string;
  companyName?: string;
  email: string;
  phoneNumber: string;
  goodsName: string;
  moid: string;
  transferStatus: AccountHolderAuthStatus;

}

export interface PaymentInfo {
  processStatus?: string;
  requestDate?: string;
  email?: string;
  phoneNumber?: string;
  goodsName?: string;
  moid?: string;
  buyerName?: string;
  sendMethod?: string;
  sendDate?: string;
  failCount?: number;
  paymentStatus?: string;
  paymentMethod?: string;
  paymentDate?: string;
  paymentLimitDate?: string;
}

// 상세정보 Info Enum
export enum InfoWrapKeys {
  Title = 'Title',
  Transaction = 'Transaction',
  Payment = 'Payment',
  Detail = 'Detail'
};

export enum DetailInfoSectionKeys {
  Title = 'Title',
  Detail = 'Detail',
  Payment = 'Payment',
  Deets = 'Deets'
}

export interface DetailResponse {
  titleInfo?: TitleInfo //최상단 섹션
  detailInfo?: DetailInfo // '상세 정보' 섹션
  paymentInfo?: PaymentInfo // '결제 정보' 섹션
  detailExposure?: boolean // 분리승인 상세 노출 여부
}

export interface DetailInfoSectionProps extends DetailResponse {
  additionalServiceCategory?: AdditionalServiceCategory
  show?: boolean;
  onClickToShowInfo?: (info: DetailInfoSectionKeys) => void;
}

// ========================================
// 공통 Filter 타입들
// ========================================

export interface FilterProps {
  filterOn: boolean;
  setFilterOn: (filterOn: boolean) => void;
}

// ========================================
// 정산기관 관련 타입들
// ========================================

export enum SettlementAgencyTabKeys {
  Manage = 'Manage',
  Deposit = 'Deposit',
  Member = 'Member',
}

export interface SettlementAgencyTabProps {
  activeTab: SettlementAgencyTabKeys;
}

export interface SettlementAgencyBottomAgreeProps {
  bottomAgreeOn: boolean;
  setBottomAgreeOn: (bottomAgreeOn: boolean) => void;
}

// ========================================
// 공통 리스트 관련 타입들
// ========================================

export interface ListItemProps extends
  KeyInPaymentListItem, AccountHolderSearchListItem,
  AccountHolderAuthListItem, LinkPaymentHistoryListItem,
  LinkPaymentWaitListItem, SmsPaymentListItem,
  PayoutContent, FundAccountTransferContentItem,
  FundAccountResultContentItem,
  ArsListContent, AlimtalkListContent, FaceAuthListItem {
  additionalServiceCategory?: AdditionalServiceCategory;
  mid?: string;
  seq?: string;
  onResendClick?: (mid: string, tid: string) => void;
}

export interface ListDateGroupProps {
  additionalServiceCategory?: AdditionalServiceCategory;
  date?: string;
  items?: Array<ListItemProps>;
  mid?: string;
  onResendClick?: (mid: string, tid: string) => void;
}

export interface AdditionalServiceListProps {
  additionalServiceCategory: AdditionalServiceCategory;
  listItems: Record<string, Array<ListItemProps>>;
}

// ========================================
// 확장 서비스 API 타입들
// ========================================

export interface ExtensionRequestParams {
  mid: string;
}



// ========================================


// 확장 서비스 목록 관련
export interface ExtensionListParams extends ExtensionRequestParams {

}

export interface activeExtensionListItem {
  extensionCode: string;
  extensionName: string;
  extensionInformation: string;
}

export interface availableExtensionListItem {
  extensionCode: string;
  extensionName: string;
  extensionInformation: string;
}

export interface ExtensionListItemProps {
  activeExtensionList: Array<activeExtensionListItem>;
  availableExtensionList: Array<availableExtensionListItem>;
}

export interface ExtensionListResponse {
  activeExtensionList: string[];
  availableExtensionList: string[];
}

export interface ExtensionCheckParams {
  extensionCode: string;
}

export interface ExtensionCheckResponse {
  checkResult: boolean;
}

// ========================================
// 기타 UI 컴포넌트 타입들
// ========================================

export interface IntroListItemProps {
  className?: string;
  serviceName?: string;
  serviceDesc?: string;
  icon?: string;
  path?: string;
}

export interface ArsCardPaymentFinishProps {
  requestSuccess: boolean;
  setRequestSuccess: (requestSuccess: boolean) => void;
}

