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

import dev.lions.unionflow.server.api.dto.ong.ProjetOngDTO;
import dev.lions.unionflow.server.entity.ong.ProjetOng;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

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

    @Mapping(target = "organisationId", source = "organisation.id")
    ProjetOngDTO toDto(ProjetOng 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)
    @Mapping(target = "depensesReelles", ignore = true)
    @Mapping(target = "statut", ignore = true)
    ProjetOng toEntity(ProjetOngDTO 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)
    @Mapping(target = "depensesReelles", ignore = true)
    @Mapping(target = "statut", ignore = true)
    void updateEntityFromDto(ProjetOngDTO dto, @MappingTarget ProjetOng entity);
}
