package com.xindazhou.platform.convert.service.maintenance;

import com.xindazhou.platform.controller.admin.service.maintenance.vo.MaintenanceOrderRespVO;
import com.xindazhou.platform.controller.admin.service.maintenance.vo.MaintenanceOrderSaveReqVO;
import com.xindazhou.platform.dal.service.dataobject.maintenance.MaintenanceOrderDO;
import com.xindazhou.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 维保订单 Convert
 *
 * @author xindazhou
 */
@Mapper
public interface MaintenanceOrderConvert {

    MaintenanceOrderConvert INSTANCE = Mappers.getMapper(MaintenanceOrderConvert.class);

    @Mapping(target = "id", ignore = true)
    @Mapping(target = "orderId", ignore = true)
    @Mapping(target = "orderNo", ignore = true)
    @Mapping(target = "status", ignore = true)
    MaintenanceOrderDO convert(MaintenanceOrderSaveReqVO bean);

    @Mapping(target = "vehicleInfo", ignore = true) // vehicleInfo 需要通过 RPC 调用车辆服务获取
    @Mapping(target = "userInfo", ignore = true) // userInfo 需要通过 RPC 调用用户服务获取
    MaintenanceOrderRespVO convert(MaintenanceOrderDO bean);

    List<MaintenanceOrderRespVO> convertList(List<MaintenanceOrderDO> list);

    PageResult<MaintenanceOrderRespVO> convertPage(PageResult<MaintenanceOrderDO> page);

}

