import { Receipt } from "./receipt";

export interface PurchaseDetail {
  number: number;
  checkout_session?: string;
  main_payment_identifier?: string;
  date_initiated: string;
  date_confirmed: string;
  currency: string;
  site_code: string;
  locale: string;
  country_code: string;
  given_name: string;
  family_name: string;
  company_name: string;
  care_of: string;
  street_address: string;
  street_address2: string;
  postal_code: string;
  city: string;
  region: string;
  email: string;
  phone?: string;
  total_debit_amount?: string;
  total_remaining_amount?: string;
  total_discount_amount?: string;
  total_tax_amount?: string;
  receipts: Receipt[];
  accounts?: {
    reserved: string;
    captured: string;
    reverted: string;
  } | null;
  lines: Line[];
}

export type ItemProperties = Record<string, string | number | boolean>;

export interface Line {
  line_number: number;
  item_type: string;
  item_properties?: ItemProperties;
  title: string;
  reference: string;
  quantity: number;
  unit_price: string;
  total_amount: string;
  debit_amount: string;
  remaining_amount: string;
  adjustments: Adjustment[];
}

export interface Adjustment {
  adjustment_type: "CANCELLATION" | "RETURN" | "REFUND" | "DISCOUNT";
  title: string;
  receipt_number: number | null;
  quantity: number;
  total_amount: string;
}
