using Gtk 4.0;
using Adw 1;

template $OCRModelPage : Adw.NavigationPage {
  title: _("Language Models");

  child: Adw.ToolbarView {
    [top]
    Adw.HeaderBar header_bar {}

    [top]
    Adw.Clamp {
      maximum-size: 508;
      tightening-threshold: 400;

      child: SearchBar search_bar {
        search-mode-enabled: true;
        show-close-button: false;

        child: SearchEntry search_entry {
          placeholder-text: _("Search languages…");
          hexpand: true;
        };
      };
    }

    content: Gtk.ScrolledWindow {
      hscrollbar-policy: never;
      vscrollbar-policy: automatic;

      child: Adw.Clamp {
        maximum-size: 508;
        tightening-threshold: 400;
        margin-top: 24;
        margin-bottom: 24;
        margin-start: 12;
        margin-end: 12;

        child: Gtk.Box main_box {
          orientation: vertical;
          spacing: 24;

          Stack models_stack {
            transition-type: crossfade;

            StackPage {
              name: "list";

              child: Adw.PreferencesGroup {
                description: _("A Language Model is required to use the OCR feature.\nUsing the correct language model improves OCR accuracy.");
                margin-start: 4;
                margin-end: 4;
                Gtk.ListBox models_list {
                  selection-mode: none;

                  styles [
                    "boxed-list",
                  ]
                }
              };
            }

            StackPage {
              name: "empty";

              child: Adw.StatusPage no_results_page {
                icon-name: "system-search-symbolic";
                title: _("No Results Found");
                description: _("Try a different search term");
              };
            }
          }
        };
      };
    };
  };
}

