defmodule Towerops.Snmp.Profiles.Vendors.Exalt do
  @moduledoc """
  Exalt ExtendAir device-specific SNMP handling.

  Supports ExtendAir licensed and unlicensed microwave radios.

  Supported devices:
  - ExtendAir series
  - ExploreAir series
  """

  @behaviour Towerops.Snmp.Profiles.Vendors.Vendor

  alias Towerops.Snmp.Profiles.Vendors.Vendor

  @impl true
  def profile_names do
    ["extendair"]
  end

  @impl true
  def detect_hardware(_client_opts) do
    # Hardware detection handled by YAML profile
    nil
  end

  @impl true
  def discover_wireless_sensors(client_opts) do
    Vendor.fetch_sensors(wireless_oid_defs(), client_opts)
  end

  @impl true
  def wireless_oid_defs do
    # EXALT-MIB OIDs
    # Enterprise OID: 1.3.6.1.4.1.25651
    [
      # Tx Frequency (kHz, divide by 1000 for MHz)
      %{
        oid: "1.3.6.1.4.1.25651.1.2.3.1.1.7.0",
        sensor_type: "frequency",
        sensor_descr: "Tx Frequency",
        sensor_unit: "MHz",
        sensor_divisor: 1000
      },
      # Rx Frequency (kHz, divide by 1000 for MHz)
      %{
        oid: "1.3.6.1.4.1.25651.1.2.3.1.1.8.0",
        sensor_type: "frequency",
        sensor_descr: "Rx Frequency",
        sensor_unit: "MHz",
        sensor_divisor: 1000
      },
      # Tx Power (dBm * 10)
      %{
        oid: "1.3.6.1.4.1.25651.1.2.3.1.1.9.0",
        sensor_type: "power",
        sensor_descr: "Tx Power",
        sensor_unit: "dBm",
        sensor_divisor: 10
      },
      # RSL (Receive Signal Level, dBm * 10)
      %{
        oid: "1.3.6.1.4.1.25651.1.2.3.1.2.1.0",
        sensor_type: "rssi",
        sensor_descr: "RSL",
        sensor_unit: "dBm",
        sensor_divisor: 10
      },
      # SNR (dB * 10)
      %{
        oid: "1.3.6.1.4.1.25651.1.2.3.1.2.3.0",
        sensor_type: "snr",
        sensor_descr: "SNR",
        sensor_unit: "dB",
        sensor_divisor: 10
      }
    ]
  end
end
