export type PurchaseAnalysisListItem = {
  purchase_id: string;
  purchase_no: string;
  supplier_name: string;
  purchase_status: string;
  analysis_status: string;
  weight_buy: number | null;
  weight_received: number | null;
  weight_final: number | null;
  total_modal_beli: number;
  total_modal_mal: number | null;
  total_laba_rugi: number | null;
};

export type PurchaseAnalysisDetail = {
  purchase: {
    id: string;
    purchase_no: string;
    purchase_date: string;
    supplier_name: string;
    status: string;
    grand_total: number;
    line_count: number;
  };
  actuals: {
    weight_buy: number;
    weight_received: number;
    weight_final: number;
    moisture_buy_percent: number | null;
    moisture_received_percent: number | null;
    moisture_final_percent: number | null;
    above_average_ratio_percent: number | null;
    market_reference_price: number | null;
  };
  inputs: {
    status: string;
    weight_buy: number | null;
    weight_received: number | null;
    weight_final: number | null;
    moisture_buy_percent: number | null;
    moisture_received_percent: number | null;
    moisture_final_percent: number | null;
    above_average_ratio_percent: number | null;
    average_price: number | null;
    modal_beli: number | null;
    modal_masuk: number | null;
    modal_jual: number | null;
    modal_barang: number | null;
    total_modal_beli: number | null;
    total_modal_mal: number | null;
    market_reference_price: number | null;
    market_valuation_total: number | null;
    agent_profit_share_total: number;
    notes: string | null;
    cost_entries: Array<{
      id: string;
      cost_type: string;
      description: string | null;
      amount: number;
    }>;
  };
  summary: {
    berat_beli: number | null;
    berat_masuk: number | null;
    berat_akhir: number | null;
    berat_naik_percent: number | null;
    susut_tambah: number | null;
    kadar_beli_percent: number | null;
    kadar_masuk_percent: number | null;
    kadar_akhir_percent: number | null;
    barang_atas_rata2_percent: number | null;
    mk_percent: number | null;
    non_mk_percent: number | null;
    harga_mk_ar: number | null;
    harga_rata2: number | null;
    modal_beli: number | null;
    modal_masuk: number | null;
    modal_jual: number | null;
    modal_barang: number;
    operasional: number;
    total_modal_beli: number;
    total_modal_mal: number | null;
    total_laba_rugi: number | null;
    laba_rugi_agen: number;
    laba_total_per_kg: number | null;
    laba_agen_per_kg: number | null;
  };
};
