package vn.azteam.tpf.service.mapper;

import vn.azteam.tpf.domain.*;
import vn.azteam.tpf.service.dto.TBGuidelineDetailsDTO;
import vn.azteam.tpf.service.dto.TBGuidelinePeriodDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity TBGuidelinePeriod and its DTO TBGuidelinePeriodDTO.
 */
@Mapper(componentModel = "spring", uses = {TBGuidelineMapper.class})
public interface TBGuidelinePeriodMapper extends EntityMapper<TBGuidelinePeriodDTO, TBGuidelinePeriod> {

    @Mapping(source = "tbGuideline.id", target = "tbGuidelineId")
    TBGuidelinePeriodDTO toDto(TBGuidelinePeriod tBGuidelinePeriod);

    @Mapping(source = "tbGuidelineId", target = "tbGuideline")
    TBGuidelinePeriod toEntity(TBGuidelinePeriodDTO tBGuidelinePeriodDTO);

    default TBGuidelinePeriod fromId(Long id) {
        if (id == null) {
            return null;
        }
        TBGuidelinePeriod tBGuidelinePeriod = new TBGuidelinePeriod();
        tBGuidelinePeriod.setId(id);
        return tBGuidelinePeriod;
    }
}
