<%!-- Step indicator --%> <%!-- Step content --%>
<%= case @step do %> <% :snmp -> %>

{t("SNMP Configuration")}

{t("Set organization-wide SNMP defaults. Can be overridden per-site or per-device.")}

<.form id="snmp-form" for={@form} phx-change="validate_snmp" phx-submit="save_snmp">
<.input field={@form[:snmp_version]} type="select" label={t("SNMP Version")} options={[{"v1", "1"}, {"v2c", "2c"}, {"v3", "3"}]} /> <%= if @form[:snmp_version].value in ["1", "2c"] do %> <.input field={@form[:snmp_community]} type="text" label={t("Community String")} placeholder="public" /> <% end %> <%= if @form[:snmp_version].value == "3" do %> <.input field={@form[:snmpv3_username]} type="text" label={t("Username")} /> <.input field={@form[:snmpv3_auth_protocol]} type="select" label={t("Auth Protocol")} prompt="None" options={["MD5", "SHA", "SHA-224", "SHA-256", "SHA-384", "SHA-512"]} /> <.input field={@form[:snmpv3_auth_password]} type="password" label={t("Auth Password")} /> <.input field={@form[:snmpv3_priv_protocol]} type="select" label={t("Privacy Protocol")} prompt="None" options={["DES", "AES", "AES-192", "AES-256", "AES-256-C"]} /> <.input field={@form[:snmpv3_priv_password]} type="password" label={t("Privacy Password")} /> <% end %>
<% :site -> %>

{t("Add Your First Site")}

{t("Sites represent physical locations — tower sites, POPs, data centers, etc.")}

<.form id="site-form" for={@site_form} phx-change="validate_site" phx-submit="save_site">
<.input field={@site_form[:name]} type="text" label={t("Name")} placeholder="e.g. Main Tower" required /> <.input field={@site_form[:address]} type="text" label={t("Address")} placeholder="123 Tower Rd" />
<.input field={@site_form[:latitude]} type="number" label={t("Latitude")} step="any" placeholder="38.8977" /> <.input field={@site_form[:longitude]} type="number" label={t("Longitude")} step="any" placeholder="-77.0365" />
<% :billing -> %>

{t("Connect a Billing Platform")}

{t( "Optional. Sync subscriber data for outage impact analysis and inventory reconciliation." )}

<%= if @selected_provider == nil do %>
<%= for provider <- @billing_providers do %> <% end %>
<% else %>
<.form id="integration-form" for={@integration_form} phx-change="validate_integration" phx-submit="save_integration" >
<%= case @selected_provider do %> <% "sonar" -> %> <.input name="integration[instance_url]" type="text" label={t("Instance URL")} placeholder="https://myisp.sonar.software" value="" /> <.input name="integration[api_token]" type="password" label={t("API Token")} value="" /> <% "splynx" -> %> <.input name="integration[instance_url]" type="text" label={t("Instance URL")} placeholder="https://myisp.splynx.app" value="" /> <.input name="integration[api_key]" type="text" label={t("API Key")} value="" /> <.input name="integration[api_secret]" type="password" label={t("API Secret")} value="" /> <% _ -> %> <.input name="integration[api_key]" type="password" label={t("API Key")} value="" /> <% end %>
<% end %> <%= if @selected_provider == nil do %>
<% end %> <% :agent -> %>

{t("Deploy Agent")}

{t( "The TowerOps agent polls your network devices via SNMP. Deploy it on a host with network access to your infrastructure." )}

<%= if @agent_token do %>
<%= if @agent_token_value do %>

<.icon name="hero-exclamation-triangle" class="h-4 w-4 inline -mt-0.5" /> {t("Save this token — it won't be shown again.")}

{@agent_token_value}
<% else %>

{t("Agent:")} {@agent_token.name}

<% end %>

{t("Docker")}

docker run -d \
  --name towerops-agent \
  --restart unless-stopped \
  -e TOWEROPS_TOKEN=<%= if @agent_token_value, do: @agent_token_value, else: "" %> \
  -e TOWEROPS_SERVER=<%= ToweropsWeb.Endpoint.url() %> \
  --network host \
  codeberg.org/towerops-agent/towerops-agent:latest

{t("Systemd")}

curl -sSL https://install.towerops.net | \
  TOWEROPS_TOKEN=<%= if @agent_token_value, do: @agent_token_value, else: "" %> \
  TOWEROPS_SERVER=<%= ToweropsWeb.Endpoint.url() %> \
  bash
<% else %>

{t("Failed to create agent token. You can create one later in Settings → Agents.")}

<% end %>
<% end %>