import ISummary from '@/core/models/summary';
import { TspProviderResponseStatus } from '@/shared/catalog';
import { IEnumTranslate } from '@/shared/models/enum_translate.type';

export interface ISaleInvoiceFullRawResponse {
  id: string;
  code: string;
  total_amount: string;
  invoice_date: string;
  consumer_account: ConsumerAccount;
  pos: Pos;
  payments: Payment[];
  items: Item[];
  created_at: string;
  notes?: string;
  customer?: Customer;
  unknown_customer?: UnknownCustomer;
  status: IEnumTranslate<TspProviderResponseStatus>;
}

export interface ISaleInvoiceFullResponse extends ISaleInvoiceFullRawResponse {}

interface Item {
  id: string;
  good: ISummary;
}

interface Payment {
  amount: string;
  payment_method: string;
}

interface Customer {
  id: string;
  type: string;
  legal?: CustomerLegal;
  individual?: CustomerIndividual;
}

interface CustomerIndividual {
  first_name: string;
  last_name: string;
  national_id: string;
  postal_code: string;
  economic_code: string;
}

interface CustomerLegal {
  company_name: string;
  registration_number: string;
  postal_code: string;
  economic_code: string;
}

interface Pos extends ISummary {
  complex: Complex;
}

interface Complex extends ISummary {
  business_activity: ISummary;
}

interface ConsumerAccount {
  role: string;
  account: {
    username: string;
  };
}

interface UnknownCustomer {
  name?: string;
  national_code?: string;
}
