|
|
@@ -1,76 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-namespace App\Enum;
|
|
|
-
|
|
|
-use App\Entity\Film;
|
|
|
-use App\Entity\User;
|
|
|
-
|
|
|
-/**
|
|
|
- * Bascules d'état possibles pour un film, affichées par le composant
|
|
|
- * Vue SwitchEtat. Chaque cas centralise toute la configuration du
|
|
|
- * bouton : icônes, libellés, infobulle et route de bascule.
|
|
|
- *
|
|
|
- * Pour ajouter un nouveau type de bascule : ajouter un cas et compléter
|
|
|
- * les match() existants, aucun template ni composant JS à modifier.
|
|
|
- */
|
|
|
-enum BasculeFilm: string
|
|
|
-{
|
|
|
- case A_VOIR = 'a-voir';
|
|
|
- case VU = 'vu';
|
|
|
-
|
|
|
- public function routeName(): string
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => 'maliste_modifier_a_voir',
|
|
|
- self::VU => 'maliste_modifier_vus',
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public function iconeActif(): string
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => 'fa-solid fa-bookmark fa-lg',
|
|
|
- self::VU => 'fa-solid fa-eye fa-lg text-success',
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public function iconeInactif(): string
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => 'fa-regular fa-bookmark text-secondary fa-lg',
|
|
|
- self::VU => 'fa-solid fa-eye-slash fa-lg text-secondary',
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public function texteActif(): string
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => 'Supprimer ce film de votre liste à voir',
|
|
|
- self::VU => 'Supprimer ce film de votre liste des films vus',
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public function texteInactif(): string
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => 'Ajouter ce film à votre liste à voir',
|
|
|
- self::VU => 'Marquer ce film comme vu',
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public function avecInfoBulle(): bool
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => true,
|
|
|
- self::VU => false,
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- public function estActifPour(User $user, Film $film): bool
|
|
|
- {
|
|
|
- return match ($this) {
|
|
|
- self::A_VOIR => (bool) $user->wantToSee($film),
|
|
|
- self::VU => (bool) $user->haveSeen($film),
|
|
|
- };
|
|
|
- }
|
|
|
-}
|