<%= content_for :page_title, "Sync Providers" %>

<div class="space-y-4">
  <div>
    <p class="text-secondary mb-4">
      Configure credentials for third-party sync providers. Settings configured here will override environment variables.
    </p>
  </div>

  <% @provider_configurations.each do |config| %>
    <% next if config.provider_key.to_s.casecmp("simplefin").zero? %>
    <%= settings_section title: config.provider_key.titleize, collapsible: true, open: false do %>
      <%= render "settings/providers/provider_form", configuration: config %>
    <% end %>
  <% end %>

  <%= settings_section title: "Lunch Flow", collapsible: true, open: false do %>
    <turbo-frame id="lunchflow-providers-panel">
      <%= render "settings/providers/lunchflow_panel" %>
    </turbo-frame>
  <% end %>

  <%= settings_section title: "SimpleFIN", collapsible: true, open: false do %>
    <turbo-frame id="simplefin-providers-panel">
      <%= render "settings/providers/simplefin_panel" %>
    </turbo-frame>
  <% end %>

  <%= settings_section title: "Enable Banking (beta)", collapsible: true, open: false do %>
    <turbo-frame id="enable_banking-providers-panel">
      <%= render "settings/providers/enable_banking_panel" %>
    </turbo-frame>
  <% end %>

  <%= settings_section title: "CoinStats", collapsible: true, open: false do %>
    <turbo-frame id="coinstats-providers-panel">
      <%= render "settings/providers/coinstats_panel" %>
    </turbo-frame>
  <% end %>
</div>
