package fr.titionfire.ffsaf.rest.data;

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

@Data
@AllArgsConstructor
@RegisterForReflection
public class CategoryData {
    private Long id;
    private String name;
    private Long compet;
    private Integer type;

    public static CategoryData fromModel(CategoryModel model) {
        if (model == null)
            return null;

        return new CategoryData(model.getSystemId(), model.getName(), model.getCompet().getId(), model.getType());
    }
}
