package fr.titionfire.ffsaf.data.model;

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

import java.util.List;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection

@Entity
@Table(name = "category")
public class CategoryModel {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long id;

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

    String name = "";

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_compet", referencedColumnName = "id")
    CompetitionModel compet;

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_category", referencedColumnName = "id")
    List<MatchModel> matchs;

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_category", referencedColumnName = "id")
    List<TreeModel> tree;

    Integer type;

    String liceName = "1";

    @Column(nullable = false, columnDefinition = "boolean default false")
    boolean treeAreClassement = false;

    @Column(nullable = false, columnDefinition = "boolean default false")
    boolean fullClassement = false;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_preset", referencedColumnName = "id")
    CatPresetModel preset;
}
