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

import dev.lions.unionflow.server.api.dto.registre.AgrementProfessionnelDTO;
import dev.lions.unionflow.server.entity.registre.AgrementProfessionnel;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

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

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