<template>
  <v-card tile outlined :class="{ 'card--reduced': isCardReduced }">
    <v-card-title class="card__title primary" @click="toggleCardSize">
      <v-icon left class="white--text pr-5 pl-2" size="40">mdi-music-box-multiple</v-icon>
      Soundboard
    </v-card-title>
    <v-container class="text-center">
      <v-row justify="center">
        <v-col cols="12" sm="6" md="4" class="mt-4">
          <mqtt-button class="btn red" width="150" height="90" topic="/sound/playsound" message="good-response" rounded>
            <v-icon size="60">mdi-check-circle-outline</v-icon>
          </mqtt-button>
        </v-col>
        <v-col cols="12" sm="6" md="4" class="mt-4">
          <mqtt-button class="btn red" width="150" height="90" topic="/sound/playsound" message="bad-response" rounded>
            <v-icon size="60">mdi-close-circle-outline</v-icon>
          </mqtt-button>
        </v-col>
        <v-col cols="12" sm="6" md="4" class="mt-4">
          <mqtt-button class="btn red" width="150" height="90" topic="/sound/playsound" message="timer" rounded>
            <v-icon size="60">mdi-timer-outline</v-icon>
          </mqtt-button>
        </v-col>
      </v-row>
      <v-row justify="center">
        <v-col cols="12" sm="6" md="4" class="mb-4">
          <mqtt-button class="btn red" width="150" height="90" topic="/sound/playsound" message="applause" rounded>
            <v-icon size="60">mdi-human-handsup</v-icon>
          </mqtt-button>
        </v-col>
        <v-col cols="12" sm="6" md="4" class="mb-4">
          <mqtt-button class="btn red" width="150" height="90" topic="/sound/playsound" message="bell" rounded>
            <v-icon size="60">mdi-bell-outline</v-icon>
          </mqtt-button>
        </v-col>
      </v-row>
    </v-container>
  </v-card>
</template>

<script setup>
  import MqttButton from './MqttButton.vue';
  import { ref } from 'vue';

  // Variable pour contrôler l'état de la carte
  const isCardReduced = ref(false);

  // Méthode pour basculer l'état de la carte
  function toggleCardSize() {
    isCardReduced.value = !isCardReduced.value;
  }
</script>

<style scoped>
  .card--reduced {
    height: 56px; /* Réglez la hauteur réduite selon vos besoins */
    width: 190px;
    overflow: hidden;
    transition: height 0.3s ease-in-out;
  }
</style>