package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBGuideline and its DTO TBGuidelineDTO.
 */
@Mapper(componentModel = "spring", uses = {TBDetailUserMapper.class, TBCustomerMapper.class, TBSuppliesMapper.class})
public interface TBGuidelineMapper extends EntityMapper<TBGuidelineDTO, TBGuideline> {

    @Mapping(source = "createdBy.id", target = "createdById")
    @Mapping(source = "modifiedBy.id", target = "modifiedById")
    @Mapping(source = "deletedBy.id", target = "deletedById")
    @Mapping(source = "tbCustomer.id", target = "tbCustomerId")
    TBGuidelineDTO toDto(TBGuideline tBGuideline);

    @Mapping(source = "createdById", target = "createdBy")
    @Mapping(source = "modifiedById", target = "modifiedBy")
    @Mapping(source = "deletedById", target = "deletedBy")
    @Mapping(source = "tbCustomerId", target = "tbCustomer")
    @Mapping(target = "tbSupplies", ignore = true)
    TBGuideline toEntity(TBGuidelineDTO tBGuidelineDTO);

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