using Gtk 4.0;
using Adw 1;

template $Game : Box {
  orientation: vertical;
  halign: center;
  valign: start;

  Adw.Clamp {
    maximum-size: 200;

    Overlay {
      [overlay]
      Revealer play_revealer {
        transition-type: crossfade;
        valign: start;
        halign: start;

        Button play_button {
          icon-name: "media-playback-start-symbolic";
          margin-start: 6;
          margin-end: 3;
          margin-top: 6;
          margin-bottom: 3;

          styles [
            "circular",
            "osd",
          ]
        }
      }

      [overlay]
      Revealer menu_revealer {
        transition-type: crossfade;
        valign: start;
        halign: end;

        MenuButton menu_button {
          icon-name: "view-more-symbolic";
          margin-start: 3;
          margin-end: 6;
          margin-top: 6;
          margin-bottom: 3;

          styles [
            "circular",
            "osd",
          ]
        }
      }

      Button cover_button {
        name: "cover_button";
        overflow: hidden;

        accessibility {
          labelled-by: title;
        }

        Box {
          orientation: vertical;

          Overlay {
            [overlay]
            Spinner spinner {
              margin-start: 72;
              margin-end: 72;
            }

            Picture cover {
              width-request: 200;
              height-request: 300;
              hexpand: true;
              vexpand: true;
            }
          }

          Label title {
            label: _("Title");
            ellipsize: end;
            hexpand: true;
            halign: start;
            margin-top: 14;
            margin-bottom: 14;
            margin-start: 12;
            margin-end: 12;
          }
        }

        styles [
          "card",
        ]
      }
    }
  }
}

menu game_options {
  section {
    item {
      label: _("Edit");
      action: "app.edit_game";
    }

    item {
      label: _("Hide");
      action: "app.hide_game";
    }

    item {
      label: _("Remove");
      action: "app.remove_game";
    }
  }
}

menu hidden_game_options {
  section {
    item {
      label: _("Edit");
      action: "app.edit_game";
    }

    item {
      label: _("Unhide");
      action: "app.hide_game";
    }

    item {
      label: _("Remove");
      action: "app.remove_game";
    }
  }
}
