<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2026, Jiri Eischmann <jiri@eischmann.cz> and the meshy contributors -->
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<interface>
  <requires lib="gtk" version="4.0"/>
  <requires lib="libadwaita" version="1.0"/>
  <template class="MeshySettingsView" parent="GtkBox">
    <property name="orientation">vertical</property>
    <child>
      <object class="AdwPreferencesPage" id="pref_page">
        <property name="vexpand">true</property>

                <!-- Application -->
                <child>
                  <object class="AdwPreferencesGroup" id="app_group">
                    <property name="title" translatable="yes">Application</property>
                    <property name="description" translatable="yes">Configure the behavior and appearance of the application</property>
                    <child>
                      <object class="AdwComboRow" id="style_row">
                        <property name="title" translatable="yes">Style</property>
                        <property name="subtitle" translatable="yes">Choose the appearance of the application</property>
                        <property name="model">
                          <object class="GtkStringList">
                            <items>
                              <item translatable="yes">Follow System</item>
                              <item translatable="yes">Light</item>
                              <item translatable="yes">Dark</item>
                              <item translatable="yes">Palette Theme</item>
                            </items>
                          </object>
                        </property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwActionRow" id="theme_row">
                        <property name="title" translatable="yes">Palette Theme</property>
                        <property name="subtitle" translatable="yes">MeshCore Dark</property>
                        <property name="activatable">true</property>
                        <property name="visible">false</property>
                        <child type="suffix">
                          <object class="GtkImage">
                            <property name="icon-name">go-next-symbolic</property>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child>
                      <object class="AdwComboRow" id="channel_notif_row">
                        <property name="title" translatable="yes">Channel Notifications</property>
                        <property name="subtitle" translatable="yes">Default notification level for all channels</property>
                        <property name="model">
                          <object class="GtkStringList">
                            <items>
                              <item translatable="yes">All Messages</item>
                              <item translatable="yes">Mentions Only</item>
                              <item translatable="yes">None</item>
                            </items>
                          </object>
                        </property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwSwitchRow" id="background_switch">
                        <property name="title" translatable="yes">Run in Background</property>
                        <property name="subtitle" translatable="yes">Keep receiving messages after closing the window</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwSwitchRow" id="autostart_switch">
                        <property name="title" translatable="yes">Autostart</property>
                        <property name="subtitle" translatable="yes">Automatically start when you log in</property>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Radio -->
                <child>
                  <object class="AdwPreferencesGroup" id="radio_group">
                    <property name="title" translatable="yes">Radio</property>
                    <property name="description" translatable="yes">LoRa radio parameters and regional presets</property>
                    <child>
                      <object class="AdwComboRow" id="preset_row">
                        <property name="title" translatable="yes">Regional Preset</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwExpanderRow" id="radio_advanced">
                        <property name="title" translatable="yes">Preset Configuration</property>
                        <property name="subtitle" translatable="yes">Frequency, bandwidth, spreading factor, coding rate</property>
                        <child>
                          <object class="AdwEntryRow" id="freq_entry">
                            <property name="title" translatable="yes">Frequency (MHz)</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwEntryRow" id="bw_entry">
                            <property name="title" translatable="yes">Bandwidth (kHz)</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwSpinRow" id="sf_spin">
                            <property name="title" translatable="yes">Spreading Factor</property>
                            <property name="adjustment">
                              <object class="GtkAdjustment">
                                <property name="lower">5</property>
                                <property name="upper">12</property>
                                <property name="step-increment">1</property>
                                <property name="value">7</property>
                              </object>
                            </property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwSpinRow" id="cr_spin">
                            <property name="title" translatable="yes">Coding Rate</property>
                            <property name="adjustment">
                              <object class="GtkAdjustment">
                                <property name="lower">5</property>
                                <property name="upper">8</property>
                                <property name="step-increment">1</property>
                                <property name="value">5</property>
                              </object>
                            </property>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child>
                      <object class="AdwSwitchRow" id="repeat_switch">
                        <property name="title" translatable="yes">Repeat Mode</property>
                        <property name="subtitle" translatable="yes">Act as a portable repeater on an off-grid frequency</property>
                        <property name="visible">false</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwSpinRow" id="tx_spin">
                        <property name="title" translatable="yes">TX Power (dBm)</property>
                        <property name="adjustment">
                          <object class="GtkAdjustment">
                            <property name="lower">2</property>
                            <property name="upper">30</property>
                            <property name="step-increment">1</property>
                            <property name="value">20</property>
                          </object>
                        </property>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Advert -->
                <child>
                  <object class="AdwPreferencesGroup" id="advert_group">
                    <property name="title" translatable="yes">Advert</property>
                    <property name="description" translatable="yes">Configure how your node advertises itself on the mesh</property>
                    <child>
                      <object class="AdwEntryRow" id="name_entry">
                        <property name="title" translatable="yes">Device Name</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwSwitchRow" id="advert_loc_switch">
                        <property name="title" translatable="yes">Include Location in Advert</property>
                        <property name="subtitle" translatable="yes">Broadcast your position to other nodes</property>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Routing & Messaging -->
                <child>
                  <object class="AdwPreferencesGroup" id="routing_group">
                    <property name="title" translatable="yes">Routing and Messaging</property>
                    <property name="description" translatable="yes">Path routing and message delivery settings</property>
                    <child>
                      <object class="AdwComboRow" id="path_hash_combo">
                        <property name="title" translatable="yes">Default Path Hash Size</property>
                        <property name="sensitive">false</property>
                        <property name="model">
                          <object class="GtkStringList">
                            <items>
                              <item translatable="yes">1-byte (max 64 hops)</item>
                              <item translatable="yes">2-byte (max 32 hops)</item>
                              <item translatable="yes">3-byte (max 21 hops)</item>
                            </items>
                          </object>
                        </property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwSpinRow" id="multi_ack_spin">
                        <property name="title" translatable="yes">Direct Message Confirmations</property>
                        <property name="subtitle" translatable="yes">Number of ACKs sent when receiving a direct message</property>
                        <property name="sensitive">false</property>
                        <property name="adjustment">
                          <object class="GtkAdjustment">
                            <property name="lower">1</property>
                            <property name="upper">2</property>
                            <property name="step-increment">1</property>
                            <property name="value">1</property>
                          </object>
                        </property>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Location -->
                <child>
                  <object class="AdwPreferencesGroup" id="loc_group">
                    <property name="title" translatable="yes">Location</property>
                    <property name="description" translatable="yes">Set your companion's position via GPS or manually</property>
                    <child>
                      <object class="AdwSwitchRow" id="gps_switch">
                        <property name="title" translatable="yes">Companion GPS</property>
                        <property name="subtitle" translatable="yes">Enable GPS on the companion, your position will update automatically</property>
                        <property name="visible">false</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwExpanderRow" id="manual_loc_expander">
                        <property name="title" translatable="yes">Set Location Manually</property>
                        <property name="subtitle" translatable="yes">Choose another method to set the location, it will be fixed</property>
                        <child>
                          <object class="AdwEntryRow" id="lat_entry">
                            <property name="title" translatable="yes">Latitude</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwEntryRow" id="lon_entry">
                            <property name="title" translatable="yes">Longitude</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwActionRow" id="locate_row">
                            <property name="title" translatable="yes">Use My Location</property>
                            <property name="subtitle" translatable="yes">Set from this computer's location</property>
                            <property name="activatable-widget">locate_btn</property>
                            <child type="prefix">
                              <object class="GtkImage">
                                <property name="icon-name">find-location-symbolic</property>
                              </object>
                            </child>
                            <child type="suffix">
                              <object class="GtkButton" id="locate_btn">
                                <property name="icon-name">go-next-symbolic</property>
                                <property name="valign">center</property>
                                <style>
                                  <class name="flat"/>
                                </style>
                              </object>
                            </child>
                          </object>
                        </child>
                        <child>
                          <object class="AdwActionRow" id="pick_map_row">
                            <property name="title" translatable="yes">Pick on Map</property>
                            <property name="subtitle" translatable="yes">Choose a location on the map</property>
                            <property name="activatable-widget">pick_map_btn</property>
                            <child type="prefix">
                              <object class="GtkImage">
                                <property name="icon-name">map-symbolic</property>
                              </object>
                            </child>
                            <child type="suffix">
                              <object class="GtkButton" id="pick_map_btn">
                                <property name="icon-name">go-next-symbolic</property>
                                <property name="valign">center</property>
                                <style>
                                  <class name="flat"/>
                                </style>
                              </object>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Auto-Add Contacts -->
                <child>
                  <object class="AdwPreferencesGroup" id="auto_add_group">
                    <property name="title" translatable="yes">Auto-Add Contacts</property>
                    <property name="description" translatable="yes">Automatically add nodes discovered via adverts</property>
                    <child>
                      <object class="AdwSwitchRow" id="auto_add_switch">
                        <property name="title" translatable="yes">Auto-Add Contacts</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwExpanderRow" id="auto_add_expander">
                        <property name="title" translatable="yes">Auto-Add Settings</property>
                        <property name="subtitle" translatable="yes">Device types, overwrite policy, hop limit</property>
                        <child>
                          <object class="AdwSwitchRow" id="auto_chat_switch">
                            <property name="title" translatable="yes">Chat Nodes</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwSwitchRow" id="auto_repeater_switch">
                            <property name="title" translatable="yes">Repeaters</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwSwitchRow" id="auto_room_switch">
                            <property name="title" translatable="yes">Room Servers</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwSwitchRow" id="auto_sensor_switch">
                            <property name="title" translatable="yes">Sensors</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwSwitchRow" id="auto_overwrite_switch">
                            <property name="title" translatable="yes">Overwrite oldest when full</property>
                          </object>
                        </child>
                        <child>
                          <object class="AdwActionRow" id="auto_hop_limit_row">
                            <property name="title" translatable="yes">Hop limit</property>
                            <property name="subtitle" translatable="yes">0–63, leave empty for no limit</property>
                            <child type="suffix">
                              <object class="GtkEntry" id="auto_hop_limit_entry">
                                <property name="input-purpose">digits</property>
                                <property name="max-width-chars">4</property>
                                <property name="valign">center</property>
                                <property name="width-chars">4</property>
                              </object>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Telemetry Privacy -->
                <child>
                  <object class="AdwPreferencesGroup" id="tele_group">
                    <property name="title" translatable="yes">Telemetry Privacy</property>
                    <property name="description" translatable="yes">Control what others can query from your device</property>
                    <child>
                      <object class="AdwComboRow" id="tele_base_combo">
                        <property name="title" translatable="yes">Battery &amp; Sensors</property>
                        <property name="subtitle" translatable="yes">Battery, voltage, temperature, current</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwComboRow" id="tele_loc_combo">
                        <property name="title" translatable="yes">Location</property>
                        <property name="subtitle" translatable="yes">GPS coordinates</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwComboRow" id="tele_env_combo">
                        <property name="title" translatable="yes">Environment</property>
                        <property name="subtitle" translatable="yes">Humidity, pressure, air quality</property>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Regions -->
                <child>
                  <object class="AdwPreferencesGroup" id="regions_group">
                    <property name="title" translatable="yes">Regions</property>
                    <property name="description" translatable="yes">Limit flood scope of channel messages to specific regions</property>
                    <child>
                      <object class="AdwEntryRow" id="add_region_entry">
                        <property name="title" translatable="yes">Add Region (e.g. Prague)</property>
                        <property name="show-apply-button">true</property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwComboRow" id="default_scope_combo">
                        <property name="title" translatable="yes">Default Scope</property>
                        <property name="subtitle" translatable="yes">All flood packets will be scoped to this region if set</property>
                      </object>
                    </child>
                  </object>
                </child>

                <!-- Bluetooth -->
                <child>
                  <object class="AdwPreferencesGroup" id="bt_group">
                    <property name="visible">false</property>
                    <property name="title" translatable="yes">Bluetooth</property>
                    <property name="description" translatable="yes">After changing the PIN, restart the device, then unpair and re-pair. Setting 0 resets the PIN to default.</property>
                    <child>
                      <object class="AdwEntryRow" id="pin_entry">
                        <property name="title" translatable="yes">Pairing PIN</property>
                        <property name="input-purpose">digits</property>
                      </object>
                    </child>
                  </object>
                </child>

      </object>
    </child>
  </template>
</interface>
