package fr.titionfire.ffsaf.data.model;

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

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection

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

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "competition", referencedColumnName = "id")
    CompetitionModel competition;

    String lname = "";
    String fname = "";

    Categorie categorie = null;

    String club = null;

    Genre genre = null;

    String country = "fr";

    Integer weight = null;

    public CompetitionGuestModel(String s) {
        this.fname = s.substring(0, s.indexOf(" "));
        this.lname = s.substring(s.indexOf(" ") + 1);
    }

    public String getName() {
        return fname + " " + lname;
    }
}
