package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBSuppliesOrderDetails and its DTO TBSuppliesOrderDetailsDTO.
 */
@Mapper(componentModel = "spring", uses = {TBSuppliesMapper.class, TBSuppliesOrderMapper.class})
public interface TBSuppliesOrderDetailsMapper extends EntityMapper<TBSuppliesOrderDetailsDTO, TBSuppliesOrderDetails> {

    @Mapping(source = "tbSupplies.id", target = "tbSuppliesId")
    @Mapping(source = "tbSuppliesOrder.id", target = "tbSuppliesOrderId")
    TBSuppliesOrderDetailsDTO toDto(TBSuppliesOrderDetails tBSuppliesOrderDetails);

    @Mapping(source = "tbSuppliesId", target = "tbSupplies")
    @Mapping(source = "tbSuppliesOrderId", target = "tbSuppliesOrder")
    TBSuppliesOrderDetails toEntity(TBSuppliesOrderDetailsDTO tBSuppliesOrderDetailsDTO);

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