package fr.titionfire.ffsaf.rest.data;

import fr.titionfire.ffsaf.data.model.CatPresetModel;
import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@RegisterForReflection
public class PresetData {
    private Long id;
    private String name;
    private CatPresetModel.SwordType sword;
    private CatPresetModel.ShieldType shield;
    private List<CatPresetModel.CategorieEmbeddable> categories;
    private int mandatoryProtection1;
    private int mandatoryProtection2;

    public static PresetData fromModel(CatPresetModel model) {
        if (model == null)
            return null;

        return new PresetData(model.getId(), model.getName(), model.getSwordType(), model.getShieldType(),
                model.getCategories(), model.getMandatoryProtection1(), model.getMandatoryProtection2());
    }
}
