package fr.titionfire.ffsaf.net2.data;

import fr.titionfire.ffsaf.data.model.MembreModel;
import fr.titionfire.ffsaf.utils.Categorie;
import fr.titionfire.ffsaf.utils.Genre;
import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection
@Schema(hidden = true)
public class SimpleCombModel {
    Long id;
    String lname = "";
    String fname = "";
    Categorie categorie;
    SimpleClubModel club;
    Genre genre;
    int licence = 0;
    String country = "fr";

    public static SimpleCombModel fromModel(MembreModel model) {
        if (model == null)
            return null;

        return new SimpleCombModel(model.getId(), model.getLname(), model.getFname(), model.getCategorie(),
                (model.getClub() == null) ? null : SimpleClubModel.fromModel(model.getClub()),
                model.getGenre(), (model.getLicence() == null) ? -1 : model.getLicence(), model.getCountry());
    }
}
