import { BaseMetadata } from '@types/api/base-metadata';
import { Supplier } from '@/types/api/master-data/supplier';
import { Kandang } from '@/types/api/master-data/kandang';

export type HppPerKandangRow = {
  id: number;
  kandang: Kandang;
  name_with_periode?: string;
  weight_range: {
    weight_min: number;
    weight_max: number;
  };
  avg_weight_kg: number;
  egg_production_pieces: number;
  egg_production_kg: number;
  egg_hpp_rp_per_kg: number;
  egg_value_rp: number;
  feed_suppliers: Supplier[] | null;
  doc_suppliers: Supplier[] | null;
  average_doc_price_rp: number;
};

export type HppPerKandangSummaryTotal = {
  average_weight_kg: number;
  total_egg_production_pieces: number;
  total_egg_production_kg: number;
  average_egg_hpp_rp_per_kg: number;
  total_egg_value_rp: number;
  total_average_doc_price_rp: number;
};

export type HppPerKandangPerWeightRange = {
  id: number;
  weight_range: {
    weight_min: number;
    weight_max: number;
  };
  label: string;
  avg_weight_kg: number;
  egg_production_pieces: number;
  egg_production_kg: number;
  egg_hpp_rp_per_kg: number;
  egg_value_rp: number;
  feed_suppliers: Supplier[];
  doc_suppliers: Supplier[];
  average_doc_price_rp: number;
};

export type HppPerKandangSummary = {
  per_weight_range: HppPerKandangPerWeightRange[];
  total: HppPerKandangSummaryTotal;
};

export type HppPerKandangReport = BaseMetadata & {
  period: string;
  rows: HppPerKandangRow[];
  summary: HppPerKandangSummary;
};
