package vn.azteam.tpf.service.mapper;

import vn.azteam.tpf.domain.*;
import vn.azteam.tpf.service.dto.TBGuidelineActivityDTO;

import org.mapstruct.*;
import vn.azteam.tpf.service.dto.TBGuidelineDetailsObjectUpdateDTO;

/**
 * Mapper for the entity TBGuidelineActivity and its DTO TBGuidelineActivityDTO.
 */
@Mapper(componentModel = "spring", uses = {TBGuidelineDetailsMapper.class, TBActivityTypeMapper.class})
public interface TBGuidelineActivityMapper extends EntityMapper<TBGuidelineActivityDTO, TBGuidelineActivity> {

    @Mapping(source = "tbGuidelineDetails.id", target = "tbGuidelineDetailsId")
    @Mapping(source = "tbActivityType.id", target = "tbActivityTypeId")
    @Mapping(source = "tbActivityType.name", target = "activityTypeName")
    @Mapping(source = "tbActivityType.description", target = "activityTypeDescription")
    TBGuidelineActivityDTO toDto(TBGuidelineActivity tBGuidelineActivity);

    @Mapping(source = "tbGuidelineDetailsId", target = "tbGuidelineDetails")
    @Mapping(source = "tbActivityTypeId", target = "tbActivityType")
    TBGuidelineActivity toEntity(TBGuidelineActivityDTO tbGuidelineActivityDTO);


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