package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBSuppliesOrder and its DTO TBSuppliesOrderDTO.
 */
@Mapper(componentModel = "spring", uses = {TBVendorMapper.class, TBDetailUserMapper.class})
public interface TBSuppliesOrderMapper extends EntityMapper<TBSuppliesOrderDTO, TBSuppliesOrder> {

    @Mapping(source = "tbVendor.id", target = "tbVendorId")
    @Mapping(source = "createdBy.id", target = "createdById")
    @Mapping(source = "modifiedBy.id", target = "modifiedById")
    @Mapping(source = "deletedBy.id", target = "deletedById")
    TBSuppliesOrderDTO toDto(TBSuppliesOrder tBSuppliesOrder);

    @Mapping(source = "tbVendorId", target = "tbVendor")
    @Mapping(source = "createdById", target = "createdBy")
    @Mapping(source = "modifiedById", target = "modifiedBy")
    @Mapping(source = "deletedById", target = "deletedBy")
    TBSuppliesOrder toEntity(TBSuppliesOrderDTO tBSuppliesOrderDTO);

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