package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

/**
 * Mapper for the entity TBProductBlockDetailsReport and its DTO TBProductBlockDetailsReportDTO.
 */
@Mapper(componentModel = "spring", uses = {TBProductBlockDetailsMapper.class, TBCropMapper.class})
public interface TBProductBlockDetailsReportMapper extends EntityMapper<TBProductBlockDetailsReportDTO, TBProductBlockDetailsReport> {

    @Mapping(source = "tbProductBlockDetails.id", target = "tbProductBlockDetailsId")
    @Mapping(source = "tbCrop.id", target = "tbCropId")
    TBProductBlockDetailsReportDTO toDto(TBProductBlockDetailsReport tBProductBlockDetailsReport);

    @Mapping(source = "tbProductBlockDetailsId", target = "tbProductBlockDetails")
    @Mapping(source = "tbCropId", target = "tbCrop")
    TBProductBlockDetailsReport toEntity(TBProductBlockDetailsReportDTO tBProductBlockDetailsReportDTO);

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