#pragma once

#include <scwx/wsr88d/rda/level2_message.hpp>

namespace scwx::wsr88d::rda
{

class PerformanceMaintenanceData : public Level2Message
{
public:
   explicit PerformanceMaintenanceData();
   ~PerformanceMaintenanceData();

   PerformanceMaintenanceData(const PerformanceMaintenanceData&) = delete;
   PerformanceMaintenanceData&
   operator=(const PerformanceMaintenanceData&) = delete;

   PerformanceMaintenanceData(PerformanceMaintenanceData&&) noexcept;
   PerformanceMaintenanceData& operator=(PerformanceMaintenanceData&&) noexcept;

   [[nodiscard]] std::uint16_t loop_back_set_status() const;
   [[nodiscard]] std::uint32_t t1_output_frames() const;
   [[nodiscard]] std::uint32_t t1_input_frames() const;
   [[nodiscard]] std::uint32_t router_memory_used() const;
   [[nodiscard]] std::uint32_t router_memory_free() const;
   [[nodiscard]] std::uint16_t router_memory_utilization() const;
   [[nodiscard]] std::uint16_t route_to_rpg() const;
   [[nodiscard]] std::uint16_t t1_port_status() const;
   [[nodiscard]] std::uint16_t router_dedicated_ethernet_port_status() const;
   [[nodiscard]] std::uint16_t router_commercial_ethernet_port_status() const;
   [[nodiscard]] std::uint32_t csu_24hr_errored_seconds() const;
   [[nodiscard]] std::uint32_t csu_24hr_severely_errored_seconds() const;
   [[nodiscard]] std::uint32_t
   csu_24hr_severely_errored_framing_seconds() const;
   [[nodiscard]] std::uint32_t csu_24hr_unavailable_seconds() const;
   [[nodiscard]] std::uint32_t csu_24hr_controlled_slip_seconds() const;
   [[nodiscard]] std::uint32_t csu_24hr_path_coding_violations() const;
   [[nodiscard]] std::uint32_t csu_24hr_line_errored_seconds() const;
   [[nodiscard]] std::uint32_t csu_24hr_bursty_errored_seconds() const;
   [[nodiscard]] std::uint32_t csu_24hr_degraded_minutes() const;
   [[nodiscard]] std::uint32_t lan_switch_cpu_utilization() const;
   [[nodiscard]] std::uint16_t lan_switch_memory_utilization() const;
   [[nodiscard]] std::uint16_t ifdr_chasis_temperature() const;
   [[nodiscard]] std::uint16_t ifdr_fpga_temperature() const;
   [[nodiscard]] std::uint16_t ntp_status() const;
   [[nodiscard]] std::uint16_t ipc_status() const;
   [[nodiscard]] std::uint16_t commanded_channel_control() const;
   [[nodiscard]] std::uint16_t polarization() const;
   [[nodiscard]] float         ame_internal_temperature() const;
   [[nodiscard]] float         ame_receiver_module_temperature() const;
   [[nodiscard]] float         ame_bite_cal_module_temperature() const;
   [[nodiscard]] std::uint16_t ame_peltier_pulse_width_modulation() const;
   [[nodiscard]] std::uint16_t ame_peltier_status() const;
   [[nodiscard]] std::uint16_t ame_a_d_converter_status() const;
   [[nodiscard]] std::uint16_t ame_state() const;
   [[nodiscard]] float         ame_3_3v_ps_voltage() const;
   [[nodiscard]] float         ame_5v_ps_voltage() const;
   [[nodiscard]] float         ame_6_5v_ps_voltage() const;
   [[nodiscard]] float         ame_15v_ps_voltage() const;
   [[nodiscard]] float         ame_48v_ps_voltage() const;
   [[nodiscard]] float         ame_stalo_power() const;
   [[nodiscard]] float         peltier_current() const;
   [[nodiscard]] float         adc_calibration_reference_voltage() const;
   [[nodiscard]] std::uint16_t ame_mode() const;
   [[nodiscard]] std::uint16_t ame_peltier_mode() const;
   [[nodiscard]] float         ame_peltier_inside_fan_current() const;
   [[nodiscard]] float         ame_peltier_outside_fan_current() const;
   [[nodiscard]] float         horizontal_tr_limiter_voltage() const;
   [[nodiscard]] float         vertical_tr_limiter_voltage() const;
   [[nodiscard]] float         adc_calibration_offset_voltage() const;
   [[nodiscard]] float         adc_calibration_gain_correction() const;
   [[nodiscard]] std::uint16_t rcp_status() const;
   [[nodiscard]] std::string   rcp_string() const;
   [[nodiscard]] std::uint16_t spip_power_buttons() const;
   [[nodiscard]] float         master_power_administrator_load() const;
   [[nodiscard]] float         expansion_power_administrator_load() const;
   [[nodiscard]] std::uint16_t _5vdc_ps() const;
   [[nodiscard]] std::uint16_t _15vdc_ps() const;
   [[nodiscard]] std::uint16_t _28vdc_ps() const;
   [[nodiscard]] std::uint16_t neg_15vdc_ps() const;
   [[nodiscard]] std::uint16_t _45vdc_ps() const;
   [[nodiscard]] std::uint16_t filament_ps_voltage() const;
   [[nodiscard]] std::uint16_t vacuum_pump_ps_voltage() const;
   [[nodiscard]] std::uint16_t focus_coil_ps_voltage() const;
   [[nodiscard]] std::uint16_t filament_ps() const;
   [[nodiscard]] std::uint16_t klystron_warmup() const;
   [[nodiscard]] std::uint16_t transmitter_available() const;
   [[nodiscard]] std::uint16_t wg_switch_position() const;
   [[nodiscard]] std::uint16_t wg_pfn_transfer_interlock() const;
   [[nodiscard]] std::uint16_t maintenance_mode() const;
   [[nodiscard]] std::uint16_t maintenance_required() const;
   [[nodiscard]] std::uint16_t pfn_switch_position() const;
   [[nodiscard]] std::uint16_t modulator_overload() const;
   [[nodiscard]] std::uint16_t modulator_inv_current() const;
   [[nodiscard]] std::uint16_t modulator_switch_fail() const;
   [[nodiscard]] std::uint16_t main_power_voltage() const;
   [[nodiscard]] std::uint16_t charging_system_fail() const;
   [[nodiscard]] std::uint16_t inverse_diode_current() const;
   [[nodiscard]] std::uint16_t trigger_amplifier() const;
   [[nodiscard]] std::uint16_t circulator_temperature() const;
   [[nodiscard]] std::uint16_t spectrum_filter_pressure() const;
   [[nodiscard]] std::uint16_t wg_arc_vswr() const;
   [[nodiscard]] std::uint16_t cabinet_interlock() const;
   [[nodiscard]] std::uint16_t cabinet_air_temperature() const;
   [[nodiscard]] std::uint16_t cabinet_airflow() const;
   [[nodiscard]] std::uint16_t klystron_current() const;
   [[nodiscard]] std::uint16_t klystron_filament_current() const;
   [[nodiscard]] std::uint16_t klystron_vacion_current() const;
   [[nodiscard]] std::uint16_t klystron_air_temperature() const;
   [[nodiscard]] std::uint16_t klystron_airflow() const;
   [[nodiscard]] std::uint16_t modulator_switch_maintenance() const;
   [[nodiscard]] std::uint16_t post_charge_regulator_maintenance() const;
   [[nodiscard]] std::uint16_t wg_pressure_humidity() const;
   [[nodiscard]] std::uint16_t transmitter_overvoltage() const;
   [[nodiscard]] std::uint16_t transmitter_overcurrent() const;
   [[nodiscard]] std::uint16_t focus_coil_current() const;
   [[nodiscard]] std::uint16_t focus_coil_airflow() const;
   [[nodiscard]] std::uint16_t oil_temperature() const;
   [[nodiscard]] std::uint16_t prf_limit() const;
   [[nodiscard]] std::uint16_t transmitter_oil_level() const;
   [[nodiscard]] std::uint16_t transmitter_battery_charging() const;
   [[nodiscard]] std::uint16_t high_voltage_status() const;
   [[nodiscard]] std::uint16_t transmitter_recycling_summary() const;
   [[nodiscard]] std::uint16_t transmitter_inoperable() const;
   [[nodiscard]] std::uint16_t transmitter_air_filter() const;
   [[nodiscard]] std::uint16_t zero_test_bit(unsigned i) const;
   [[nodiscard]] std::uint16_t one_test_bit(unsigned i) const;
   [[nodiscard]] std::uint16_t xmtr_spip_interface() const;
   [[nodiscard]] std::uint16_t transmitter_summary_status() const;
   [[nodiscard]] float         transmitter_rf_power() const;
   [[nodiscard]] float         horizontal_xmtr_peak_power() const;
   [[nodiscard]] float         xmtr_peak_power() const;
   [[nodiscard]] float         vertical_xmtr_peak_power() const;
   [[nodiscard]] float         xmtr_rf_avg_power() const;
   [[nodiscard]] std::uint32_t xmtr_recycle_count() const;
   [[nodiscard]] float         receiver_bias() const;
   [[nodiscard]] float         transmit_imbalance() const;
   [[nodiscard]] float         xmtr_power_meter_zero() const;
   [[nodiscard]] std::uint16_t ac_unit1_compressor_shut_off() const;
   [[nodiscard]] std::uint16_t ac_unit2_compressor_shut_off() const;
   [[nodiscard]] std::uint16_t generator_maintenance_required() const;
   [[nodiscard]] std::uint16_t generator_battery_voltage() const;
   [[nodiscard]] std::uint16_t generator_engine() const;
   [[nodiscard]] std::uint16_t generator_volt_frequency() const;
   [[nodiscard]] std::uint16_t power_source() const;
   [[nodiscard]] std::uint16_t transitional_power_source() const;
   [[nodiscard]] std::uint16_t generator_auto_run_off_switch() const;
   [[nodiscard]] std::uint16_t aircraft_hazard_lighting() const;
   [[nodiscard]] std::uint16_t equipment_shelter_fire_detection_system() const;
   [[nodiscard]] std::uint16_t equipment_shelter_fire_smoke() const;
   [[nodiscard]] std::uint16_t generator_shelter_fire_smoke() const;
   [[nodiscard]] std::uint16_t utility_voltage_frequency() const;
   [[nodiscard]] std::uint16_t site_security_alarm() const;
   [[nodiscard]] std::uint16_t security_equipment() const;
   [[nodiscard]] std::uint16_t security_system() const;
   [[nodiscard]] std::uint16_t receiver_connected_to_antenna() const;
   [[nodiscard]] std::uint16_t radome_hatch() const;
   [[nodiscard]] std::uint16_t ac_unit1_filter_dirty() const;
   [[nodiscard]] std::uint16_t ac_unit2_filter_dirty() const;
   [[nodiscard]] float         equipment_shelter_temperature() const;
   [[nodiscard]] float         outside_ambient_temperature() const;
   [[nodiscard]] float         transmitter_leaving_air_temp() const;
   [[nodiscard]] float         ac_unit1_discharge_air_temp() const;
   [[nodiscard]] float         generator_shelter_temperature() const;
   [[nodiscard]] float         radome_air_temperature() const;
   [[nodiscard]] float         ac_unit2_discharge_air_temp() const;
   [[nodiscard]] float         spip_15v_ps() const;
   [[nodiscard]] float         spip_neg_15v_ps() const;
   [[nodiscard]] std::uint16_t spip_28v_ps_status() const;
   [[nodiscard]] float         spip_5v_ps() const;
   [[nodiscard]] std::uint16_t converted_generator_fuel_level() const;
   [[nodiscard]] std::uint16_t elevation_pos_dead_limit() const;
   [[nodiscard]] std::uint16_t _150v_overvoltage() const;
   [[nodiscard]] std::uint16_t _150v_undervoltage() const;
   [[nodiscard]] std::uint16_t elevation_servo_amp_inhibit() const;
   [[nodiscard]] std::uint16_t elevation_servo_amp_short_circuit() const;
   [[nodiscard]] std::uint16_t elevation_servo_amp_overtemp() const;
   [[nodiscard]] std::uint16_t elevation_motor_overtemp() const;
   [[nodiscard]] std::uint16_t elevation_stow_pin() const;
   [[nodiscard]] std::uint16_t elevation_housing_5v_ps() const;
   [[nodiscard]] std::uint16_t elevation_neg_dead_limit() const;
   [[nodiscard]] std::uint16_t elevation_pos_normal_limit() const;
   [[nodiscard]] std::uint16_t elevation_neg_normal_limit() const;
   [[nodiscard]] std::uint16_t elevation_encoder_light() const;
   [[nodiscard]] std::uint16_t elevation_gearbox_oil() const;
   [[nodiscard]] std::uint16_t elevation_handwheel() const;
   [[nodiscard]] std::uint16_t elevation_amp_ps() const;
   [[nodiscard]] std::uint16_t azimuth_servo_amp_inhibit() const;
   [[nodiscard]] std::uint16_t azimuth_servo_amp_short_circuit() const;
   [[nodiscard]] std::uint16_t azimuth_servo_amp_overtemp() const;
   [[nodiscard]] std::uint16_t azimuth_motor_overtemp() const;
   [[nodiscard]] std::uint16_t azimuth_stow_pin() const;
   [[nodiscard]] std::uint16_t azimuth_housing_5v_ps() const;
   [[nodiscard]] std::uint16_t azimuth_encoder_light() const;
   [[nodiscard]] std::uint16_t azimuth_gearbox_oil() const;
   [[nodiscard]] std::uint16_t azimuth_bull_gear_oil() const;
   [[nodiscard]] std::uint16_t azimuth_handwheel() const;
   [[nodiscard]] std::uint16_t azimuth_servo_amp_ps() const;
   [[nodiscard]] std::uint16_t servo() const;
   [[nodiscard]] std::uint16_t pedestal_interlock_switch() const;
   [[nodiscard]] std::uint16_t coho_clock() const;
   [[nodiscard]] std::uint16_t rf_generator_frequency_select_oscillator() const;
   [[nodiscard]] std::uint16_t rf_generator_rf_stalo() const;
   [[nodiscard]] std::uint16_t rf_generator_phase_shifted_coho() const;
   [[nodiscard]] std::uint16_t _9v_receiver_ps() const;
   [[nodiscard]] std::uint16_t _5v_receiver_ps() const;
   [[nodiscard]] std::uint16_t _18v_receiver_ps() const;
   [[nodiscard]] std::uint16_t neg_9v_receiver_ps() const;
   [[nodiscard]] std::uint16_t _5v_single_channel_rdaiu_ps() const;
   [[nodiscard]] float         horizontal_short_pulse_noise() const;
   [[nodiscard]] float         horizontal_long_pulse_noise() const;
   [[nodiscard]] float         horizontal_noise_temperature() const;
   [[nodiscard]] float         vertical_short_pulse_noise() const;
   [[nodiscard]] float         vertical_long_pulse_noise() const;
   [[nodiscard]] float         vertical_noise_temperature() const;
   [[nodiscard]] float         horizontal_linearity() const;
   [[nodiscard]] float         horizontal_dynamic_range() const;
   [[nodiscard]] float         horizontal_delta_dbz0() const;
   [[nodiscard]] float         vertical_delta_dbz0() const;
   [[nodiscard]] float         kd_peak_measured() const;
   [[nodiscard]] float         short_pulse_horizontal_dbz0() const;
   [[nodiscard]] float         long_pulse_horizontal_dbz0() const;
   [[nodiscard]] std::uint16_t velocity_processed() const;
   [[nodiscard]] std::uint16_t width_processed() const;
   [[nodiscard]] std::uint16_t velocity_rf_gen() const;
   [[nodiscard]] std::uint16_t width_rf_gen() const;
   [[nodiscard]] float         horizontal_i0() const;
   [[nodiscard]] float         vertical_i0() const;
   [[nodiscard]] float         vertical_dynamic_range() const;
   [[nodiscard]] float         short_pulse_vertical_dbz0() const;
   [[nodiscard]] float         long_pulse_vertical_dbz0() const;
   [[nodiscard]] float         horizontal_power_sense() const;
   [[nodiscard]] float         vertical_power_sense() const;
   [[nodiscard]] float         zdr_offset() const;
   [[nodiscard]] float         clutter_suppression_delta() const;
   [[nodiscard]] float         clutter_suppression_unfiltered_power() const;
   [[nodiscard]] float         clutter_suppression_filtered_power() const;
   [[nodiscard]] float         vertical_linearity() const;
   [[nodiscard]] std::uint16_t state_file_read_status() const;
   [[nodiscard]] std::uint16_t state_file_write_status() const;
   [[nodiscard]] std::uint16_t bypass_map_file_read_status() const;
   [[nodiscard]] std::uint16_t bypass_map_file_write_status() const;
   [[nodiscard]] std::uint16_t current_adaptation_file_read_status() const;
   [[nodiscard]] std::uint16_t current_adaptation_file_write_status() const;
   [[nodiscard]] std::uint16_t censor_zone_file_read_status() const;
   [[nodiscard]] std::uint16_t censor_zone_file_write_status() const;
   [[nodiscard]] std::uint16_t remote_vcp_file_read_status() const;
   [[nodiscard]] std::uint16_t remote_vcp_file_write_status() const;
   [[nodiscard]] std::uint16_t baseline_adaptation_file_read_status() const;
   [[nodiscard]] std::uint16_t read_status_of_prf_sets() const;
   [[nodiscard]] std::uint16_t clutter_filter_map_file_read_status() const;
   [[nodiscard]] std::uint16_t clutter_filter_map_file_write_status() const;
   [[nodiscard]] std::uint16_t general_disk_io_error() const;
   [[nodiscard]] std::uint8_t  rsp_status() const;
   [[nodiscard]] std::uint8_t  cpu1_temperature() const;
   [[nodiscard]] std::uint8_t  cpu2_temperature() const;
   [[nodiscard]] std::uint16_t rsp_motherboard_power() const;
   [[nodiscard]] std::uint16_t spip_comm_status() const;
   [[nodiscard]] std::uint16_t hci_comm_status() const;
   [[nodiscard]] std::uint16_t signal_processor_command_status() const;
   [[nodiscard]] std::uint16_t ame_communication_status() const;
   [[nodiscard]] std::uint16_t rms_link_status() const;
   [[nodiscard]] std::uint16_t rpg_link_status() const;
   [[nodiscard]] std::uint16_t interpanel_link_status() const;
   [[nodiscard]] std::uint32_t performance_check_time() const;
   [[nodiscard]] std::uint16_t version() const;

   bool Parse(std::istream& is) override;

   static std::shared_ptr<PerformanceMaintenanceData>
   Create(Level2MessageHeader&& header, std::istream& is);

private:
   class Impl;
   std::unique_ptr<Impl> p;
};

} // namespace scwx::wsr88d::rda
