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

  <template class="PreferencesDialog" parent="AdwPreferencesWindow">
    <property name="title" translatable="yes">Preferences</property>
    <property name="modal">True</property>
    <property name="default-width">600</property>

    <child>
      <object class="AdwPreferencesPage">
        <property name="title" translatable="yes">General</property>
        <property name="icon-name">preferences-system-symbolic</property>

        <child>
          <object class="AdwPreferencesGroup">
            <property name="title" translatable="yes">Network</property>
            <property name="description" translatable="yes">HTTP connection settings</property>

            <child>
              <object class="AdwSwitchRow" id="tls_verification_row">
                <property name="title" translatable="yes">Force TLS Verification</property>
                <property name="subtitle" translatable="yes">Verify TLS certificates for HTTPS connections. Disable to test endpoints with self-signed certificates.</property>
              </object>
            </child>

            <child>
              <object class="AdwSpinRow" id="timeout_row">
                <property name="title" translatable="yes">Request Timeout</property>
                <property name="subtitle" translatable="yes">Maximum time to wait for a response (in seconds)</property>
                <property name="adjustment">
                  <object class="GtkAdjustment">
                    <property name="lower">5</property>
                    <property name="upper">300</property>
                    <property name="step-increment">5</property>
                    <property name="page-increment">10</property>
                    <property name="value">30</property>
                  </object>
                </property>
              </object>
            </child>
          </object>
        </child>

        <child>
          <object class="AdwPreferencesGroup">
            <property name="title" translatable="yes">History</property>
            <property name="description" translatable="yes">Manage request history</property>

            <child>
              <object class="AdwActionRow">
                <property name="title" translatable="yes">Clear All History</property>
                <property name="subtitle" translatable="yes">Remove all saved request and response history</property>
                <child>
                  <object class="GtkButton" id="clear_history_button">
                    <property name="label" translatable="yes">Clear</property>
                    <property name="valign">center</property>
                    <signal name="clicked" handler="on_clear_history_clicked" swapped="no"/>
                    <style>
                      <class name="destructive-action"/>
                    </style>
                  </object>
                </child>
              </object>
            </child>
          </object>
        </child>

        <child>
          <object class="AdwPreferencesGroup">
            <property name="title" translatable="yes">Data</property>
            <property name="description" translatable="yes">Project storage and backup</property>

            <child>
              <object class="AdwActionRow" id="data_folder_row">
                <property name="title" translatable="yes">Data folder</property>
                <child>
                  <object class="GtkButton" id="open_folder_button">
                    <property name="label" translatable="yes">Open</property>
                    <property name="valign">center</property>
                    <signal name="clicked" handler="on_open_folder_clicked" swapped="no"/>
                  </object>
                </child>
              </object>
            </child>

            <child>
              <object class="AdwActionRow" id="backup_folder_row">
                <property name="title" translatable="yes">Backup folder</property>
                <child>
                  <object class="GtkBox">
                    <property name="spacing">6</property>
                    <property name="valign">center</property>
                    <child>
                      <object class="GtkButton" id="choose_backup_folder_button">
                        <property name="label" translatable="yes">Choose…</property>
                        <signal name="clicked" handler="on_choose_backup_folder_clicked" swapped="no"/>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>

            <child>
              <object class="AdwSwitchRow" id="auto_backup_row">
                <property name="title" translatable="yes">Auto-backup on save</property>
                <property name="subtitle" translatable="yes">Copy project files to the backup folder after each save</property>
              </object>
            </child>

            <child>
              <object class="AdwActionRow">
                <property name="title" translatable="yes">Backup now</property>
                <property name="subtitle" translatable="yes">Copy all project files to the backup folder</property>
                <child>
                  <object class="GtkButton" id="backup_now_button">
                    <property name="label" translatable="yes">Backup</property>
                    <property name="valign">center</property>
                    <signal name="clicked" handler="on_backup_now_clicked" swapped="no"/>
                  </object>
                </child>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>
  </template>
</interface>
