package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBProductStockUpdate and its DTO TBProductStockUpdateDTO.
 */
@Mapper(componentModel = "spring", uses = {TBProductBlockDetailsMapper.class, TBActivityMapper.class})
public interface TBProductStockUpdateMapper extends EntityMapper<TBProductStockUpdateDTO, TBProductStockUpdate> {

    @Mapping(source = "tbProductBlockDetails.id", target = "tbProductBlockDetailsId")
    @Mapping(source = "tbProductBlockDetails.code", target = "tbProductBlockDetailsCode")
    @Mapping(source = "tbProductBlockDetails.quantity", target = "tbProductBlockDetailsQuantity")
    @Mapping(source = "tbProductBlockDetails.tbEntity.name", target = "tbProductBlockDetailsEntityName")
    @Mapping(source = "tbActivity.id", target = "tbActivityId")
    TBProductStockUpdateDTO toDto(TBProductStockUpdate tBProductStockUpdate);

    @Mapping(source = "tbProductBlockDetailsId", target = "tbProductBlockDetails")
    @Mapping(source = "tbActivityId", target = "tbActivity")
    TBProductStockUpdate toEntity(TBProductStockUpdateDTO tBProductStockUpdateDTO);

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