package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBSuppliesPriceHistory and its DTO TBSuppliesPriceHistoryDTO.
 */
@Mapper(componentModel = "spring", uses = {TBSuppliesOrderMapper.class, TBSuppliesInWarehouseMapper.class})
public interface TBSuppliesPriceHistoryMapper extends EntityMapper<TBSuppliesPriceHistoryDTO, TBSuppliesPriceHistory> {

    @Mapping(source = "tbSuppliesOrder.id", target = "tbSuppliesOrderId")
    @Mapping(source = "tbSuppliesInWarehouse.id", target = "tbSuppliesInWarehouseId")
    TBSuppliesPriceHistoryDTO toDto(TBSuppliesPriceHistory tBSuppliesPriceHistory);

    @Mapping(source = "tbSuppliesOrderId", target = "tbSuppliesOrder")
    @Mapping(source = "tbSuppliesInWarehouseId", target = "tbSuppliesInWarehouse")
    TBSuppliesPriceHistory toEntity(TBSuppliesPriceHistoryDTO tBSuppliesPriceHistoryDTO);

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