package it.sw.pa.comune.artegna.service.mapper;

import it.sw.pa.comune.artegna.domain.Liberatoria;
import it.sw.pa.comune.artegna.domain.ModelloLiberatoria;
import it.sw.pa.comune.artegna.domain.UtenteApp;
import it.sw.pa.comune.artegna.service.dto.LiberatoriaDTO;
import it.sw.pa.comune.artegna.service.dto.ModelloLiberatoriaDTO;
import it.sw.pa.comune.artegna.service.dto.UtenteAppDTO;
import org.mapstruct.*;

/**
 * Mapper for the entity {@link Liberatoria} and its DTO {@link LiberatoriaDTO}.
 */
@Mapper(componentModel = "spring")
public interface LiberatoriaMapper extends EntityMapper<LiberatoriaDTO, Liberatoria> {
    @Mapping(target = "utente", source = "utente", qualifiedByName = "utenteAppUsername")
    @Mapping(target = "modelloLiberatoria", source = "modelloLiberatoria", qualifiedByName = "modelloLiberatoriaId")
    LiberatoriaDTO toDto(Liberatoria s);

    @Named("utenteAppUsername")
    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "id", source = "id")
    @Mapping(target = "username", source = "username")
    UtenteAppDTO toDtoUtenteAppUsername(UtenteApp utenteApp);

    @Named("modelloLiberatoriaId")
    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "id", source = "id")
    ModelloLiberatoriaDTO toDtoModelloLiberatoriaId(ModelloLiberatoria modelloLiberatoria);
}
