using Gtk 4.0;
using Adw 1;

Adw.PreferencesWindow _root {
  default-width: 600;
  default-height: 500;
  width-request: 360;
  modal: true;
  destroy-with-parent: false;
  hide-on-close: true;
  title: _("Preferences");

  Adw.PreferencesPage {
    Adw.PreferencesGroup {
      title: _("User Interface");

      Adw.ComboRow _themeRow {
        title: _("Theme");
        model: Gtk.StringList {
          strings [C_("Theme", "Light"), C_("Theme", "Dark"), C_("Theme", "System")]
        };

        [prefix]
        Gtk.Image {
          icon-name: "dark-mode-symbolic";
        }
      }

      Adw.SwitchRow _rememberLastOpenedFolderRow {
        title: _("Remember Last Opened Library");

        [prefix]
        Gtk.Image {
          icon-name: "folder-symbolic";
        }
      }
    }

    Adw.PreferencesGroup {
      title: _("Music Library");

      Adw.SwitchRow _includeSubfoldersRow {
        title: _("Include Subfolders");

        [prefix]
        Gtk.Image {
          icon-name: "folder-remote-symbolic";
        }
      }

      Adw.ComboRow _sortFilesRow {
        title: _("Sort Files By");
        model: Gtk.StringList {
          strings [_("File Name"), _("File Path"), _("Title"), _("Artist"), _("Album"), _("Year"), _("Track"),  _("Genre")]
        };

        [prefix]
        Gtk.Image {
          icon-name: "view-sort-descending-symbolic";
        }
      }
    }

    Adw.PreferencesGroup {
      title: _("Music File");

      Adw.SwitchRow _preserveModificationTimestampRow {
        title: _("Preserve Modification Timestamp");

        [prefix]
        Gtk.Image {
          icon-name: "editor-symbolic";
        }
      }

      Adw.SwitchRow _limitCharactersRow {
        title: _("Limit File Name Characters");
        subtitle: _("Restricts characters in file names to only those supported by Windows.");

        [prefix]
        Gtk.Image {
          icon-name: "insert-text-symbolic";
        }
      }
    }

    Adw.PreferencesGroup {
      title: _("Web Services");

      Adw.SwitchRow _overwriteTagWithMusicBrainzRow {
        title: _("Overwrite Tag With MusicBrainz");
        subtitle: _("Enable to overwrite existing tag metadata with data found from MusicBrainz. If disabled, only blank tag properties will be filled.");

        [prefix]
        Gtk.Image {
          icon-name: "tag-outline-symbolic";
        }
      }

      Adw.SwitchRow _overwriteAlbumArtWithMusicBrainzRow {
        title: _("Overwrite Album Art With MusicBrainz");
        subtitle: _("Enable to overwrite existing album art with art found from MusicBrainz.");

        [prefix]
        Gtk.Image {
          icon-name: "image-symbolic";
        }
      }
      
      Adw.SwitchRow _overwriteLyricsWithWebRow {
        title: _("Overwrite Lyrics From Web Service");
        subtitle: _("Enable to overwrite existing lyrics with that found from downloading lyrics from the web. If disabled, only blank lyrics will be filled.");

        [prefix]
        Gtk.Image {
          icon-name: "quotation-symbolic";
        }
      }

      Adw.EntryRow _acoustIdRow {
        title: _("AcoustId User API Key");

        [prefix]
        Gtk.Image {
          icon-name: "fingerprint-symbolic";
        }

        [suffix]
        Gtk.Button _acoustIdButton {
          valign: center;
          tooltip-text: _("Get New API Key");
          icon-name: "window-new-symbolic";

          styles ["flat"]
        }
      }
    }
  }
}