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

import dev.lions.unionflow.server.api.dto.collectefonds.ContributionCollecteDTO;
import dev.lions.unionflow.server.entity.collectefonds.ContributionCollecte;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

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

    @Mapping(target = "campagneId", source = "campagne.id")
    @Mapping(target = "membreDonateurId", source = "membreDonateur.id")
    ContributionCollecteDTO toDto(ContributionCollecte 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 = "campagne", ignore = true)
    @Mapping(target = "membreDonateur", ignore = true)
    ContributionCollecte toEntity(ContributionCollecteDTO 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 = "campagne", ignore = true)
    @Mapping(target = "membreDonateur", ignore = true)
    void updateEntityFromDto(ContributionCollecteDTO dto, @MappingTarget ContributionCollecte entity);
}
