package vn.azteam.tpf.service.mapper;

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

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

/**
 * Mapper for the entity TBEntityLocationOfCustomer and its DTO TBEntityLocationOfCustomerDTO.
 */
@Mapper(componentModel = "spring", uses = {TBCustomerMapper.class, TBEntityMapper.class})
public interface TBEntityLocationOfCustomerMapper extends EntityMapper<TBEntityLocationOfCustomerDTO, TBEntityLocationOfCustomer> {

    @Mapping(source = "tbCustomer.id", target = "tbCustomerId")
    @Mapping(source = "tbEntity.id", target = "tbEntityId")
    TBEntityLocationOfCustomerDTO toDto(TBEntityLocationOfCustomer tbEntityLocationOfCustomer);

    @Mapping(source = "tbCustomerId", target = "tbCustomer")
    @Mapping(source = "tbEntityId", target = "tbEntity")
    TBEntityLocationOfCustomer toEntity(TBEntityLocationOfCustomerDTO tbEntityLocationOfCustomerDTO);

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