package vn.azteam.tpf.service.mapper;

import vn.azteam.tpf.domain.*;
import vn.azteam.tpf.service.dto.TBCropDTO;
import vn.azteam.tpf.service.dto.TBCustomerHasCropTypeDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity TBCustomerHasCropType and its DTO TBCustomerHasCropTypeDTO.
 */
@Mapper(componentModel = "spring", uses = {TBCropTypeMapper.class, TBCustomerMapper.class, TBActivityTypeMapper.class})
public interface TBCustomerHasCropTypeMapper extends EntityMapper<TBCustomerHasCropTypeDTO, TBCustomerHasCropType> {

    @Mapping(source = "tbCropType.id", target = "tbCropTypeId")
    @Mapping(source = "tbCropType.name", target = "tbCropTypeName")
    @Mapping(source = "tbCustomer.id", target = "tbCustomerId")
    @Mapping(source = "tbActivityType.id", target = "tbActivityTypeId")
    @Mapping(source = "tbActivityType.name", target = "tbActivityTypeName")
    TBCustomerHasCropTypeDTO toDto(TBCustomerHasCropType tBCustomerHasCropType);

    @Mapping(source = "tbCropTypeId", target = "tbCropType")
    @Mapping(source = "tbCustomerId", target = "tbCustomer")
    @Mapping(source = "tbActivityTypeId", target = "tbActivityType")
    TBCustomerHasCropType toEntity(TBCustomerHasCropTypeDTO tbCustomerHasCropTypeDTO);

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