package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

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

    @Mapping(source = "deletedBy.id", target = "deletedById")
    @Mapping(source = "createdBy.id", target = "createdById")
    @Mapping(source = "modifiedBy.id", target = "modifiedById")
    @Mapping(source = "tbCustomer.id", target = "tbCustomerId")
    TBEnvironmentalParameterDTO toDto(TBEnvironmentalParameter tBEnvironmentalParameter);

    @Mapping(source = "deletedById", target = "deletedBy")
    @Mapping(source = "createdById", target = "createdBy")
    @Mapping(source = "modifiedById", target = "modifiedBy")
    @Mapping(source = "tbCustomerId", target = "tbCustomer")
    TBEnvironmentalParameter toEntity(TBEnvironmentalParameterDTO tBEnvironmentalParameterDTO);

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