using Gtk 4.0;
using Adw 1;

Adw.Window _root {
  default-width: 400;
  width-request: 320;
  modal: true;
  resizable: true;
  default-widget: _createButton;

  content: Adw.ToolbarView {
    [top]
    Adw.HeaderBar {
      title-widget: Gtk.Label { };

      styles ["flat"]
    }

    Gtk.WindowHandle {
      Gtk.Box {
        orientation: vertical;
        spacing: 24;

        Gtk.Label {
          label: _("Playlist");
          
          styles ["title-2"]
        }
      
        Adw.PreferencesGroup {
          margin-start: 24;
          margin-end: 24;
          
          Adw.EntryRow _pathRow {
            title: _("Path");
            editable: false;
            
            [suffix]
            Gtk.Button _selectSaveLocationButton {
              valign: center;
              icon-name: "document-open-symbolic";
              tooltip-text: _("Select Save Location");
              
              styles ["flat"]
            }
          }
          
          Adw.ComboRow _formatRow {
            title: _("Format");
            model: Gtk.StringList {
              strings ["M3U", "PLS", "XSPF", "SMIL", "ASX", "B4S", "DPL"]
            };
          }
          
          Adw.SwitchRow _relativePathsRow {
            title: _("Use Relative Paths");
          }
          
          Adw.SwitchRow _selectedFilesOnlyRow {
            title: _("Include Only Selected Files");
          }
        }
        
        Gtk.Box {
          orientation: horizontal;
          spacing: 24;
          halign: center;
          homogeneous: true;
          margin-top: 24;
          margin-bottom: 24;

          Gtk.Button _createButton {
            valign: center;
            label: _("Create");
            sensitive: false;

            styles ["pill", "suggested-action"]
          }
        }
      }
    }
  };

  Gtk.ShortcutController {
    Gtk.Shortcut {
      trigger: "Escape";
      action: "action(window.close)";
    }
  }
}