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

import dev.lions.unionflow.server.api.dto.culte.DonReligieuxDTO;
import dev.lions.unionflow.server.entity.culte.DonReligieux;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

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

    @Mapping(target = "institutionId", source = "institution.id")
    @Mapping(target = "fideleId", source = "fidele.id")
    DonReligieuxDTO toDto(DonReligieux 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 = "institution", ignore = true)
    @Mapping(target = "fidele", ignore = true)
    DonReligieux toEntity(DonReligieuxDTO 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 = "institution", ignore = true)
    @Mapping(target = "fidele", ignore = true)
    void updateEntityFromDto(DonReligieuxDTO dto, @MappingTarget DonReligieux entity);
}
