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

import it.sw.pa.comune.artegna.domain.AuditLog;
import it.sw.pa.comune.artegna.domain.UtenteApp;
import it.sw.pa.comune.artegna.service.dto.AuditLogDTO;
import it.sw.pa.comune.artegna.service.dto.UtenteAppDTO;
import org.mapstruct.*;

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

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