package com.oguerreiro.resilient.service.mapper;

import com.oguerreiro.resilient.domain.Period;
import com.oguerreiro.resilient.domain.PeriodVersion;
import com.oguerreiro.resilient.service.dto.PeriodDTO;
import com.oguerreiro.resilient.service.dto.PeriodVersionDTO;
import org.mapstruct.*;

/**
 * Mapper for the entity {@link PeriodVersion} and its DTO {@link PeriodVersionDTO}.
 */
@Mapper(componentModel = "spring")
public interface PeriodVersionMapper extends ResilientEntityMapper<PeriodVersionDTO, PeriodVersion> {
    @Mapping(target = "period", source = "period", qualifiedByName = "periodName")
    PeriodVersionDTO toDto(PeriodVersion s);

    @Named("periodName")
    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "id", source = "id")
    @Mapping(target = "name", source = "name")
    PeriodDTO toDtoPeriodName(Period period);
}
