package fr.titionfire.ffsaf.data.model;

import fr.titionfire.ffsaf.utils.Categorie;
import fr.titionfire.ffsaf.utils.CompetitionSystem;
import fr.titionfire.ffsaf.utils.RegisterMode;
import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection

@Entity
@Table(name = "compet")
public class CompetitionModel {
    @Id
    @Access(AccessType.PROPERTY)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long id;

    @Column(name = "system_type")
    CompetitionSystem system;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "club", referencedColumnName = "id")
    ClubModel club;

    String name;

    String uuid;

    Date date;
    Date todate;

    @Column(columnDefinition = "TEXT")
    String description;
    String adresse;

    Date startRegister;
    Date endRegister;

    RegisterMode registerMode;

    boolean publicVisible;

    @OneToMany(mappedBy = "competition", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    List<RegisterModel> insc;

    @OneToMany(mappedBy = "competition", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    List<CompetitionGuestModel> guests = new ArrayList<>();

    @OneToMany(mappedBy = "competition", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
    List<CatPresetModel> catPreset = new ArrayList<>();

    List<Categorie> requiredWeight = new ArrayList<>();

    List<Long> banMembre = new ArrayList<>();

    String owner;

    List<String> admin = new ArrayList<>();
    @Column(name = "table_")
    List<String> table = new ArrayList<>();

    @Column(columnDefinition = "TEXT")
    String data1;
    @Column(columnDefinition = "TEXT")
    String data2;
    @Column(columnDefinition = "TEXT")
    String data3;
    @Column(columnDefinition = "TEXT")
    String data4;

    @Column(columnDefinition = "TEXT")
    String config;
}
