package cn.lihongjie.coal.emDeviceData.mapper;

import cn.lihongjie.coal.base.mapper.BaseMapper;
import cn.lihongjie.coal.base.mapper.CommonEntityMapper;
import cn.lihongjie.coal.base.mapper.CommonMapper;
import cn.lihongjie.coal.emDevice.client.DustApi;
import cn.lihongjie.coal.emDeviceData.dto.CreateEmDeviceDataDto;
import cn.lihongjie.coal.emDeviceData.dto.EmDeviceDataDto;
import cn.lihongjie.coal.emDeviceData.dto.UpdateEmDeviceDataDto;
import cn.lihongjie.coal.emDeviceData.entity.EmDeviceDataEntity;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.control.DeepClone;

@Mapper(
        componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
        uses = {CommonMapper.class, CommonEntityMapper.class},
        mappingControl = DeepClone.class)
public interface EmDeviceDataMapper
        extends BaseMapper<
                EmDeviceDataEntity,
                EmDeviceDataDto,
                CreateEmDeviceDataDto,
                UpdateEmDeviceDataDto> {
    @Mappings(
            { @Mapping(target = "status", ignore = true),
            @Mapping(target = "device", ignore = true)}
    )
    void updateEntity(@MappingTarget EmDeviceDataEntity emDeviceData, DustApi.DeviceData x);
}
