package dev.lions.unionflow.server.mapper.agricole;

import dev.lions.unionflow.server.api.dto.agricole.CampagneAgricoleDTO;
import dev.lions.unionflow.server.entity.agricole.CampagneAgricole;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

@Mapper(componentModel = "cdi", builder = @org.mapstruct.Builder(disableBuilder = true))
public interface CampagneAgricoleMapper {

    @Mapping(target = "organisationCoopId", source = "organisation.id")
    CampagneAgricoleDTO toDto(CampagneAgricole entity);

    @Mapping(target = "id", ignore = true)
    @Mapping(target = "dateCreation", ignore = true)
    @Mapping(target = "dateModification", ignore = true)
    @Mapping(target = "creePar", ignore = true)
    @Mapping(target = "modifiePar", ignore = true)
    @Mapping(target = "version", ignore = true)
    @Mapping(target = "actif", ignore = true)
    @Mapping(target = "organisation", ignore = true)
    CampagneAgricole toEntity(CampagneAgricoleDTO dto);

    @Mapping(target = "id", ignore = true)
    @Mapping(target = "dateCreation", ignore = true)
    @Mapping(target = "dateModification", ignore = true)
    @Mapping(target = "creePar", ignore = true)
    @Mapping(target = "modifiePar", ignore = true)
    @Mapping(target = "version", ignore = true)
    @Mapping(target = "actif", ignore = true)
    @Mapping(target = "organisation", ignore = true)
    void updateEntityFromDto(CampagneAgricoleDTO dto, @MappingTarget CampagneAgricole entity);
}
