defmodule Towerops.Snmp.Profiles.Vendors.Siae do
  @moduledoc """
  SIAE Microelettronica device-specific SNMP handling.

  Supports ALFO and ALFOplus series microwave radios.

  Supported devices:
  - ALFO 80HD series
  - ALFOplus series
  """

  @behaviour Towerops.Snmp.Profiles.Vendors.Vendor

  alias Towerops.Snmp.Profiles.Vendors.Vendor

  @impl true
  def profile_names do
    ["alfo80hd"]
  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
    # SIAE ALFO MIB OIDs
    # Enterprise OID: 1.3.6.1.4.1.3373
    [
      # Tx Power
      %{
        oid: "1.3.6.1.4.1.3373.1103.80.1.1.11.1",
        sensor_type: "power",
        sensor_descr: "Tx Power",
        sensor_unit: "dBm",
        sensor_divisor: 10
      },
      # Rx Power (RSL)
      %{
        oid: "1.3.6.1.4.1.3373.1103.80.1.1.12.1",
        sensor_type: "rssi",
        sensor_descr: "Rx Power",
        sensor_unit: "dBm",
        sensor_divisor: 10
      },
      # SNR
      %{
        oid: "1.3.6.1.4.1.3373.1103.80.1.1.14.1",
        sensor_type: "snr",
        sensor_descr: "SNR",
        sensor_unit: "dB",
        sensor_divisor: 10
      },
      # Frequency
      %{
        oid: "1.3.6.1.4.1.3373.1103.80.1.1.3.1",
        sensor_type: "frequency",
        sensor_descr: "Tx Frequency",
        sensor_unit: "MHz",
        sensor_divisor: 1000
      }
    ]
  end
end
