<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk" version="4.0"/>
  <requires lib="libadwaita" version="1.0"/>

  <template class="HistoryDialog" parent="AdwDialog">
    <property name="title" translatable="yes">Previous Scans</property>
    <property name="width-request">340</property>
    <property name="height-request">400</property>
    <property name="content-width">480</property>
    <property name="content-height">640</property>
    <child>
      <object class="AdwToastOverlay" id="toast_overlay">
        <child>
          <object class="AdwToolbarView">
        <child type="top">
          <object class="AdwHeaderBar"/>
        </child>
        <child type="top">
          <object class="GtkBox">
            <property name="orientation">vertical</property>
            <child>
              <object class="GtkBox" id="filter_bar">
                <property name="spacing">8</property>
                <property name="margin-start">12</property>
                <property name="margin-end">12</property>
                <property name="margin-top">6</property>
                <property name="margin-bottom">6</property>
                <child>
                  <object class="GtkMenuButton" id="filter_button">
                    <property name="label" translatable="yes">All</property>
                    <property name="tooltip-text" translatable="yes">Filter scans by date</property>
                    <property name="popover">
                      <object class="GtkPopover" id="filter_popover">
                        <child>
                          <object class="GtkListBox" id="preset_list">
                            <property name="selection-mode">none</property>
                            <style>
                              <class name="menu"/>
                            </style>
                          </object>
                        </child>
                      </object>
                    </property>
                    <style>
                      <class name="flat"/>
                    </style>
                  </object>
                </child>
                <child>
                  <object class="GtkLabel">
                    <property name="hexpand">true</property>
                  </object>
                </child>
                <child>
                  <object class="GtkToggleButton" id="custom_toggle">
                    <property name="label" translatable="yes">Custom Range…</property>
                    <property name="tooltip-text" translatable="yes">Pick a custom date range</property>
                    <style>
                      <class name="flat"/>
                    </style>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkRevealer" id="custom_revealer">
                <property name="transition-type">slide-down</property>
                <property name="reveal-child">false</property>
                <child>
                  <object class="GtkBox">
                    <property name="orientation">vertical</property>
                    <property name="spacing">8</property>
                    <property name="margin-start">12</property>
                    <property name="margin-end">12</property>
                    <property name="margin-bottom">6</property>
                    <child>
                      <object class="GtkSeparator">
                        <property name="orientation">horizontal</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkBox">
                        <property name="spacing">8</property>
                        <child>
                          <object class="GtkLabel">
                            <property name="label" translatable="yes">From</property>
                            <property name="width-request">40</property>
                            <property name="halign">start</property>
                            <style>
                              <class name="caption"/>
                              <class name="dim-label"/>
                            </style>
                          </object>
                        </child>
                        <child>
                          <object class="GtkDropDown" id="start_day">
                            <property name="valign">center</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkDropDown" id="start_month">
                            <property name="valign">center</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkDropDown" id="start_year">
                            <property name="valign">center</property>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child>
                      <object class="GtkBox">
                        <property name="spacing">8</property>
                        <child>
                          <object class="GtkLabel">
                            <property name="label" translatable="yes">To</property>
                            <property name="width-request">40</property>
                            <property name="halign">start</property>
                            <style>
                              <class name="caption"/>
                              <class name="dim-label"/>
                            </style>
                          </object>
                        </child>
                        <child>
                          <object class="GtkDropDown" id="end_day">
                            <property name="valign">center</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkDropDown" id="end_month">
                            <property name="valign">center</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkDropDown" id="end_year">
                            <property name="valign">center</property>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child>
                      <object class="GtkBox">
                        <property name="spacing">8</property>
                        <property name="homogeneous">true</property>
                        <child>
                          <object class="GtkButton" id="custom_clear_button">
                            <property name="label" translatable="yes">Clear</property>
                            <style>
                              <class name="flat"/>
                            </style>
                          </object>
                        </child>
                        <child>
                          <object class="GtkButton" id="custom_apply_button">
                            <property name="label" translatable="yes">Apply</property>
                            <style>
                              <class name="suggested-action"/>
                            </style>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkStack" id="history_stack">
            <child>
              <object class="GtkStackPage">
                <property name="name">list</property>
                <property name="child">
                  <object class="GtkOverlay">
                    <child>
                      <object class="GtkScrolledWindow" id="history_scrolled">
                        <property name="vexpand">true</property>
                        <child>
                          <object class="GtkListBox" id="history_list">
                            <property name="selection-mode">none</property>
                            <property name="valign">start</property>
                            <property name="margin-top">12</property>
                            <property name="margin-bottom">48</property>
                            <property name="margin-start">12</property>
                            <property name="margin-end">12</property>
                            <signal name="row-activated" handler="on_scan_row_activated"/>
                            <style>
                              <class name="boxed-list"/>
                            </style>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child type="overlay">
                      <object class="GtkButton" id="scroll_top_button">
                        <property name="icon-name">go-up-symbolic</property>
                        <property name="tooltip-text" translatable="yes">Scroll to top</property>
                        <property name="halign">end</property>
                        <property name="valign">end</property>
                        <property name="margin-end">12</property>
                        <property name="margin-bottom">12</property>
                        <property name="visible">False</property>
                        <signal name="clicked" handler="on_scroll_top_clicked"/>
                        <style>
                          <class name="osd"/>
                          <class name="circular"/>
                        </style>
                      </object>
                    </child>
                  </object>
                </property>
              </object>
            </child>
            <child>
              <object class="GtkStackPage">
                <property name="name">empty</property>
                <property name="child">
                  <object class="AdwStatusPage" id="empty_status_page">
                    <property name="title" translatable="yes">No Previous Scans</property>
                    <property name="description" translatable="yes">Your scan history will appear here.</property>
                    <property name="icon-name">document-open-recent-symbolic</property>
                  </object>
                </property>
              </object>
            </child>
          </object>
        </child>
      </object>
        </child>
      </object>
    </child>
  </template>
</interface>
