package common

// ECUStat describes ecu stat received from clickhouse.
type ECUStat struct {
	ECUName          string  `json:"ecu_name" ch:"ecu_name"`
	IncorrectValues  uint64  `json:"signals_w_incorrect_values" ch:"signals_w_incorrect_values"`
	AllZero          uint64  `json:"signals_all_zero" ch:"signals_all_zero"`
	ECUSignalsTotal  uint64  `json:"number_of_ecu_signals" ch:"number_of_ecu_signals"`
	SignalsTotal     uint64  `json:"total_signal_records" ch:"total_signal_records"`
	IncorrectPercent float64 `json:"incorrect_val_signal_pct" ch:"incorrect_val_signal_pct"`
	ZeroPercent      float64 `json:"zero_signals_pct" ch:"zero_signals_pct"`
}

// StatsFilter is expected to be used for stats request.
type StatsFilter struct {
	MinOutOfRangePct float32  `validate:"required" json:"min_out_of_range_pct"`
	MinZeroPct       float32  `validate:"required" json:"min_zero_pct"`
	Hours            int      `validate:"required" json:"hours"`
	VINs             []string `validate:"required,min=1,dive,vin" json:"vins"`
	DBCs             []string `validate:"required,min=1" json:"dbcs"`
	ECUs             []string `validate:"required,min=1" json:"ecus"`
}

// VINStatsFilter is expected to be used for stats request for a specific vehicle.
type VINStatsFilter struct {
	MinOutOfRangePct float32  `validate:"required" json:"min_out_of_range_pct"`
	MinZeroPct       float32  `validate:"required" json:"min_zero_pct"`
	Hours            int      `validate:"required" json:"hours"`
	VIN              string   `validate:"required,vin" json:"-"`
	DBC              string   `validate:"required" json:"-"`
	ECUs             []string `validate:"required,min=1" json:"ecus"`
}
