package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBSuppliesInWarehouse and its DTO TBSuppliesInWarehouseDTO.
 */
@Mapper(componentModel = "spring", uses = {TBEntityMapper.class, TBSuppliesMapper.class, TBDetailUserMapper.class})
public interface TBSuppliesInWarehouseMapper extends EntityMapper<TBSuppliesInWarehouseDTO, TBSuppliesInWarehouse> {

    @Mapping(source = "tbEntity.id", target = "tbEntityId")
    @Mapping(source = "tbEntity.name", target = "tbEntityName")
    @Mapping(source = "tbSupplies.name", target = "tbSuppliesName")
    @Mapping(source = "tbSupplies.unit", target = "unit")
    @Mapping(source = "tbSupplies.id", target = "tbSuppliesId")
    @Mapping(source = "createdBy.id", target = "createdById")
    @Mapping(source = "modifiedBy.id", target = "modifiedById")
    @Mapping(source = "deletedBy.id", target = "deletedById")
    TBSuppliesInWarehouseDTO toDto(TBSuppliesInWarehouse tBSuppliesInWarehouse);

    @Mapping(source = "tbEntityId", target = "tbEntity")
    @Mapping(source = "tbSuppliesId", target = "tbSupplies")
    @Mapping(source = "createdById", target = "createdBy")
    @Mapping(source = "modifiedById", target = "modifiedBy")
    @Mapping(source = "deletedById", target = "deletedBy")
    TBSuppliesInWarehouse toEntity(TBSuppliesInWarehouseDTO tBSuppliesInWarehouseDTO);

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