package fr.titionfire.ffsaf.data.model; import fr.titionfire.ffsaf.utils.Categorie; import io.quarkus.runtime.annotations.RegisterForReflection; import jakarta.persistence.*; import lombok.*; import java.util.ArrayList; import java.util.List; @Getter @Setter @Builder @AllArgsConstructor @NoArgsConstructor @RegisterForReflection @Entity @Table(name = "category_preset") public class CatPresetModel { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "competition", referencedColumnName = "id") CompetitionModel competition; String name = ""; @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "category_preset_catconfig", joinColumns = @JoinColumn(name = "id_preset")) List categories; SwordType swordType = SwordType.NONE; ShieldType shieldType = ShieldType.NONE; /* * 1 - 1 - Casque * 2 - 2 - Gorgerin * 3 - 4 - Coquille et Protection pelvienne * 4 - 8 - Gant main(s) armée(s) * 5 - 16 - Gant main bouclier * 6 - 32 - Plastron * 7 - 64 - Protection de bras armé(s) * 8 - 128 - Protection de bras de bouclier * 9 - 256 - Protection de jambes * 10 - 512 - Protection de genoux * 11 - 1024 - Protection de coudes * 12 - 2048 - Protection dorsale * 13 - 4096 - Protection de pieds */ int mandatoryProtection1 = 0; int mandatoryProtection2 = 0; @ManyToMany(mappedBy = "categoriesInscrites", fetch = FetchType.LAZY) private List registers = new ArrayList<>(); @ManyToMany(mappedBy = "categoriesInscrites", fetch = FetchType.LAZY) private List guest = new ArrayList<>(); public enum SwordType { NONE, ONE_HAND, TWO_HAND, SABER } public enum ShieldType { NONE, STANDARD, ROUND, TEARDROP, BUCKLER } @Getter @Setter @AllArgsConstructor @NoArgsConstructor @RegisterForReflection @Embeddable public static class CategorieEmbeddable { Categorie categorie; long roundDuration; long pauseDuration; } }