export interface FabricTokenResponse {
  token: string;
  expires_in?: number | string;
}

export interface CreateOrderBizContent {
  notify_url: string;
  appid: string;
  merch_code: string;
  merch_order_id: string;
  trade_type: 'Checkout' | 'InApp' | 'MiniApp';
  title: string;
  total_amount: string;
  trans_currency: string;
  timeout_express: string;
}

export interface CreateOrderRequest {
  timestamp: string;
  nonce_str: string;
  method: 'payment.preorder';
  version: '1.0';
  biz_content: CreateOrderBizContent;
  sign: string;
  sign_type: 'SHA256WithRSA';
}

export interface CreateOrderResponse {
  code?: string;
  msg?: string;
  biz_content?: {
    prepay_id?: string;
    receiveCode?: string;
    [key: string]: unknown;
  };
  [key: string]: unknown;
}

export type TelebirrTradeStatus =
  | 'PAY_SUCCESS'
  | 'PAY_FAILED'
  | 'WAIT_PAY'
  | 'ORDER_CLOSED'
  | 'PAYING'
  | 'ACCEPTED'
  | 'REFUNDING'
  | 'REFUND_SUCCESS'
  | 'REFUND_FAILED';

export interface QueryOrderResponse {
  result?: 'SUCCESS' | 'FAIL';
  code?: string;
  msg?: string;
  nonce_str?: string;
  sign?: string;
  sign_type?: string;
  biz_content?: {
    merch_order_id?: string;
    order_status?: string;
    trade_status?: TelebirrTradeStatus | string;
    payment_order_id?: string;
    trans_id?: string;
    trans_time?: string;
    trans_currency?: string;
    total_amount?: string;
    [key: string]: unknown;
  };
  [key: string]: unknown;
}

