package vn.azteam.tpf.service.mapper;

import vn.azteam.tpf.domain.*;
import vn.azteam.tpf.service.dto.TBCustomerDTO;
import vn.azteam.tpf.service.dto.TBLocationOfCustomerDTO;

import org.mapstruct.*;

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

    @Mapping(source = "tbCustomer.id", target = "tbCustomerId")
    TBLocationOfCustomerDTO toDto(TBLocationOfCustomer tbLocationOfCustomer);

    @Mapping(source = "tbCustomerId", target = "tbCustomer")
    TBLocationOfCustomer toEntity(TBLocationOfCustomerDTO tbLocationOfCustomerDTO);

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