<?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="MeshyContactDetailDialog" parent="AdwDialog">
    <property name="content-width">420</property>
    <property name="content-height">520</property>

    <property name="child">
      <object class="AdwToolbarView">
        <child type="top">
          <object class="AdwHeaderBar">
            <property name="show-title">true</property>
          </object>
        </child>
        <property name="content">
          <object class="GtkScrolledWindow">
            <property name="hscrollbar-policy">never</property>
            <property name="vexpand">true</property>
            <child>
              <object class="AdwClamp">
                <property name="maximum-size">420</property>
                <property name="child">
                  <object class="GtkBox" id="content_box">
                    <property name="orientation">vertical</property>
                    <property name="spacing">12</property>
                    <property name="margin-start">12</property>
                    <property name="margin-end">12</property>
                    <property name="margin-top">12</property>
                    <property name="margin-bottom">12</property>

                    <!-- Contact Info group -->
                    <child>
                      <object class="AdwPreferencesGroup" id="info_group">
                        <property name="title" translatable="yes">Contact Info</property>

                        <child>
                          <object class="AdwEntryRow" id="name_entry">
                            <property name="title" translatable="yes">Name</property>
                            <property name="show-apply-button">true</property>
                          </object>
                        </child>

                        <child>
                          <object class="AdwSwitchRow" id="favorite_switch">
                            <property name="title" translatable="yes">Favorite</property>
                            <property name="subtitle" translatable="yes">Pin to top of contacts list</property>
                          </object>
                        </child>

                        <child>
                          <object class="AdwActionRow" id="type_row">
                            <property name="title" translatable="yes">Type</property>
                          </object>
                        </child>

                        <child>
                          <object class="AdwActionRow" id="key_row">
                            <property name="title" translatable="yes">Public Key</property>
                            <property name="subtitle-selectable">true</property>
                            <child type="suffix">
                              <object class="GtkButton" id="copy_btn">
                                <property name="icon-name">edit-copy-symbolic</property>
                                <property name="valign">center</property>
                                <property name="tooltip-text" translatable="yes">Copy to clipboard</property>
                                <style>
                                  <class name="flat"/>
                                </style>
                              </object>
                            </child>
                          </object>
                        </child>

                        <child>
                          <object class="AdwActionRow" id="last_seen_row">
                            <property name="title" translatable="yes">Last Seen</property>
                          </object>
                        </child>

                      </object>
                    </child>

                    <!-- Routing group -->
                    <child>
                      <object class="AdwPreferencesGroup" id="routing_group">
                        <property name="title" translatable="yes">Routing</property>

                        <child>
                          <object class="GtkListBoxRow" id="toggle_row">
                            <property name="selectable">false</property>
                            <property name="activatable">false</property>
                            <property name="child">
                              <object class="GtkBox">
                                <property name="orientation">horizontal</property>
                                <property name="halign">fill</property>
                                <property name="margin-top">8</property>
                                <property name="margin-bottom">8</property>
                                <property name="margin-start">8</property>
                                <property name="margin-end">8</property>
                                <child>
                                  <object class="AdwToggleGroup" id="routing_toggle">
                                    <property name="homogeneous">true</property>
                                    <property name="hexpand">true</property>
                                    <child>
                                      <object class="AdwToggle">
                                        <property name="label" translatable="yes">Classic</property>
                                        <property name="name">classic</property>
                                      </object>
                                    </child>
                                    <child>
                                      <object class="AdwToggle">
                                        <property name="label" translatable="yes">Smart</property>
                                        <property name="name">smart</property>
                                      </object>
                                    </child>
                                  </object>
                                </child>
                              </object>
                            </property>
                          </object>
                        </child>

                        <child>
                          <object class="AdwEntryRow" id="out_path_entry">
                            <property name="title" translatable="yes">Out Path</property>
                            <property name="show-apply-button">true</property>
                          </object>
                        </child>

                        <child>
                          <object class="AdwActionRow" id="reset_path_row">
                            <property name="title" translatable="yes">Reset Path</property>
                            <property name="subtitle" translatable="yes">Clear the established path and switch to flood</property>
                            <child type="suffix">
                              <object class="GtkButton" id="reset_path_btn">
                                <property name="icon-name">edit-clear-symbolic</property>
                                <property name="valign">center</property>
                              </object>
                            </child>
                          </object>
                        </child>

                        <child>
                          <object class="AdwActionRow" id="smart_paths_row">
                            <property name="title" translatable="yes">Available Routes</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="AdwSwitchRow" id="auto_reset_switch">
                            <property name="title" translatable="yes">Automatically Reset Path</property>
                            <property name="subtitle" translatable="yes">Switch to flood after failed delivery attempts</property>
                          </object>
                        </child>

                        <child>
                          <object class="AdwSwitchRow" id="flood_switch">
                            <property name="title" translatable="yes">Force Flood</property>
                            <property name="subtitle" translatable="yes">Always broadcast, never use an established path</property>
                          </object>
                        </child>

                      </object>
                    </child>

                    <!-- Telemetry group -->
                    <child>
                      <object class="AdwPreferencesGroup" id="tele_group">
                        <property name="title" translatable="yes">Telemetry</property>

                        <child>
                          <object class="AdwActionRow" id="req_tele_row">
                            <property name="title" translatable="yes">Request Telemetry</property>
                            <property name="subtitle" translatable="yes">Query this contact's telemetry data</property>
                            <child type="suffix">
                              <object class="GtkButton" id="req_tele_btn">
                                <property name="icon-name">view-refresh-symbolic</property>
                                <property name="valign">center</property>
                              </object>
                            </child>
                          </object>
                        </child>

                      </object>
                    </child>

                    <!-- Danger Zone group -->
                    <child>
                      <object class="AdwPreferencesGroup" id="danger_group">
                        <property name="title" translatable="yes">Danger Zone</property>

                        <child>
                          <object class="AdwActionRow" id="remove_row">
                            <property name="title" translatable="yes">Remove Contact</property>
                            <child type="suffix">
                              <object class="GtkButton" id="remove_btn">
                                <property name="icon-name">user-trash-symbolic</property>
                                <property name="valign">center</property>
                                <style>
                                  <class name="destructive-action"/>
                                </style>
                              </object>
                            </child>
                          </object>
                        </child>

                      </object>
                    </child>

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