<%= content_for :page_title, t(".page_title") %>

<%= t(".title") %>

<%= t(".subtitle") %>

<%= form_with url: settings_debug_path, method: :get, class: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4 items-end" do |f| %>
<%= f.label :category, t(".filters.category"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.select :category, options_for_select([[t(".filters.all"), ""]] + @categories.map { |value| [value, value] }, params[:category]), {}, class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full" %>
<%= f.label :level, t(".filters.level"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.select :level, options_for_select([[t(".filters.all"), ""]] + @levels.map { |value| [value, value] }, params[:level]), {}, class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full" %>
<%= f.label :source, t(".filters.source"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.select :source, options_for_select([[t(".filters.all"), ""]] + @sources.map { |value| [value, value] }, params[:source]), {}, class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full" %>
<%= f.label :provider_key, t(".filters.provider"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.select :provider_key, options_for_select([[t(".filters.all"), ""]] + @provider_keys.map { |value| [value, value] }, params[:provider_key]), {}, class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full" %>
<%= f.label :start_date, t(".filters.start_date"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.date_field :start_date, value: @start_date || params[:start_date], class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full" %>
<%= f.label :end_date, t(".filters.end_date"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.date_field :end_date, value: @end_date || params[:end_date], class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full" %>
<%= f.label :family_id, t(".filters.family_id"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.text_field :family_id, value: params[:family_id], class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full font-mono" %>
<%= f.label :account_id, t(".filters.account_id"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.text_field :account_id, value: params[:account_id], class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full font-mono" %>
<%= f.label :user_id, t(".filters.user_id"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.text_field :user_id, value: params[:user_id], class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full font-mono" %>
<%= f.label :account_provider_id, t(".filters.account_provider_id"), class: "block text-sm font-medium text-primary mb-1" %> <%= f.text_field :account_provider_id, value: params[:account_provider_id], class: "rounded-lg border border-primary px-3 py-2 text-sm bg-container-inset text-primary w-full font-mono" %>
<%= render DS::Button.new(variant: :primary, size: :md, type: "submit", text: t(".filters.submit"), class: "justify-center") %> <%= render DS::Link.new(text: t(".filters.reset"), href: settings_debug_path, variant: "ghost") %>
<% end %>
<% if @debug_log_entries.any? %>
<% @debug_log_entries.each do |entry| %> <% end %>
<%= t(".table.time") %> <%= t(".table.level") %> <%= t(".table.category") %> <%= t(".table.source") %> <%= t(".table.message") %> <%= t(".table.context") %> <%= t(".table.metadata") %>
<%= l(entry.created_at, format: :long) %> <%= entry.level %> <%= entry.category %> <%= entry.source %> <%= entry.message %>
<%= t(".context.provider", value: entry.provider_key.presence || t(".missing_value")) %>
<%= t(".context.family", value: entry.family_id || t(".missing_value")) %>
<%= t(".context.account", value: entry.account_id || t(".missing_value")) %>
<%= t(".context.user", value: entry.user_id || t(".missing_value")) %>
<%= t(".context.account_provider", value: entry.account_provider_id || t(".missing_value")) %>
<% if entry.metadata.present? %> <%= render DS::Disclosure.new(variant: :inline) do |disclosure| %> <% disclosure.with_summary_content do %> <%= t(".table.view_metadata") %> <% end %>
<%= JSON.pretty_generate(entry.metadata) %>
<% end %> <% else %> <%= t(".missing_value") %> <% end %>
<% else %>
<%= t(".empty") %>
<% end %>
<% if @pagy.pages > 1 %>
<%= render "shared/pagination", pagy: @pagy %>
<% end %>