package fr.titionfire.ffsaf.rest.data;

import fr.titionfire.ffsaf.data.model.AffiliationRequestModel;
import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

@Data
@Builder
@AllArgsConstructor
@RegisterForReflection
public class SimpleReqAffiliationResume {
    @Schema(description = "L'identifiant de la demande d'affiliation.", example = "1")
    Long id;
    @Schema(description = "Le nom de l'association.", example = "Association sportive")
    String name;
    @Schema(description = "Le numéro SIRET ou RNA de l'association.", example = "12345678901234")
    String stateId;
    @Schema(description = "La saison de l'affiliation.", example = "2025")
    int saison;

    public static SimpleReqAffiliationResume fromModel(AffiliationRequestModel model) {
        if (model == null)
            return null;

        return new SimpleReqAffiliationResumeBuilder()
                .id(model.getId())
                .name(model.getName())
                .stateId(model.getState_id())
                .saison(model.getSaison())
                .build();
    }
}
