package dto

type HppPerKandangFiltersDTO struct {
	AreaID         string `json:"area_id"`
	LocationID     string `json:"location_id"`
	KandangID      string `json:"kandang_id"`
	WeightMin      string `json:"weight_min"`
	WeightMax      string `json:"weight_max"`
	Period         string `json:"period"`
	ShowUnrecorded string `json:"show_unrecorded"`
}

type HppPerKandangMetaDTO struct {
	Page         int                     `json:"page"`
	Limit        int                     `json:"limit"`
	TotalPages   int64                   `json:"total_pages"`
	TotalResults int64                   `json:"total_results"`
	Filters      HppPerKandangFiltersDTO `json:"filters"`
}

type HppPerKandangResponseData struct {
	Period  string                  `json:"period"`
	Rows    []HppPerKandangRowDTO   `json:"rows"`
	Summary HppPerKandangSummaryDTO `json:"summary"`
}

type HppPerKandangRowDTO struct {
	ID                  int                         `json:"id"`
	Kandang             HppPerKandangRowKandangDTO  `json:"kandang"`
	NameWithPeriode     string                      `json:"name_with_periode"`
	WeightRange         HppPerKandangWeightRangeDTO `json:"weight_range"`
	AvgWeightKg         float64                     `json:"avg_weight_kg"`
	EggProductionPieces int64                       `json:"egg_production_pieces"`
	EggProductionKg     float64                     `json:"egg_production_kg"`
	// EggProductionTotalWeightKg float64                     `json:"egg_production_total_weight_kg"`
	// EggProductionTotalPieces   int64                       `json:"egg_production_total_pieces"`
	// FeedCostRp               float64                     `json:"feed_cost_rp"`
	// OvkCostRp                float64                     `json:"ovk_cost_rp"`
	EggHppRpPerKg     float64                    `json:"egg_hpp_rp_per_kg"`
	EggValueRp        int64                      `json:"egg_value_rp"`
	FeedSuppliers     []HppPerKandangSupplierDTO `json:"feed_suppliers"`
	DocSuppliers      []HppPerKandangSupplierDTO `json:"doc_suppliers"`
	AverageDocPriceRp int64                      `json:"average_doc_price_rp"`
	// HppRp             float64                    `json:"hpp_rp"`
	// RemainingValueRp  int64                      `json:"remaining_value_rp"`
}

type HppPerKandangRowKandangDTO struct {
	ID       int64                    `json:"id"`
	Name     string                   `json:"name"`
	Status   string                   `json:"status"`
	Location HppPerKandangLocationDTO `json:"location"`
	Pic      HppPerKandangPICDTO      `json:"pic"`
}

type HppPerKandangLocationDTO struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type HppPerKandangPICDTO struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type HppPerKandangWeightRangeDTO struct {
	WeightMin float64 `json:"weight_min"`
	WeightMax float64 `json:"weight_max"`
}

type HppPerKandangSupplierDTO struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Alias    string `json:"alias"`
	Category string `json:"category"`
}

type HppPerKandangSummaryDTO struct {
	PerWeightRange []HppPerKandangSummaryWeightRangeDTO `json:"per_weight_range"`
	Total          HppPerKandangSummaryTotalDTO         `json:"total"`
}

type HppPerKandangSummaryWeightRangeDTO struct {
	ID                  int                         `json:"id"`
	WeightRange         HppPerKandangWeightRangeDTO `json:"weight_range"`
	Label               string                      `json:"label"`
	AvgWeightKg         float64                     `json:"avg_weight_kg"`
	EggProductionPieces int64                       `json:"egg_production_pieces"`
	EggProductionKg     float64                     `json:"egg_production_kg"`
	EggHppRpPerKg       float64                     `json:"egg_hpp_rp_per_kg"`
	EggValueRp          int64                       `json:"egg_value_rp"`
	FeedSuppliers       []HppPerKandangSupplierDTO  `json:"feed_suppliers"`
	DocSuppliers        []HppPerKandangSupplierDTO  `json:"doc_suppliers"`
	AverageDocPriceRp   float64                     `json:"average_doc_price_rp"`
	HppRp               float64                     `json:"hpp_rp"`
	RemainingValueRp    int64                       `json:"remaining_value_rp"`
}

type HppPerKandangSummaryTotalDTO struct {
	AverageWeightKg          float64 `json:"average_weight_kg"`
	TotalEggProductionPieces int64   `json:"total_egg_production_pieces"`
	TotalEggProductionKg     float64 `json:"total_egg_production_kg"`
	AverageEggHppRpPerKg     float64 `json:"average_egg_hpp_rp_per_kg"`
	TotalEggValueRp          int64   `json:"total_egg_value_rp"`
	TotalAverageDocPriceRp   float64 `json:"total_average_doc_price_rp"`
}

func NewHppPerKandangFiltersDTO(area, location, kandang, weightMin, weightMax, period, showUnrecorded string) HppPerKandangFiltersDTO {
	return HppPerKandangFiltersDTO{
		AreaID:         area,
		LocationID:     location,
		KandangID:      kandang,
		WeightMin:      weightMin,
		WeightMax:      weightMax,
		Period:         period,
		ShowUnrecorded: showUnrecorded,
	}
}
