package cn.ey.biz.module.system.convert.engagement.task;

import cn.ey.biz.common.pojo.PageResult;
import cn.ey.biz.module.system.api.engagement.code.dto.EngagementCodeRuleSimpleRespDTO;
import cn.ey.biz.module.system.api.engagement.task.dto.EngagementTaskRuleSimpleRespDTO;
import cn.ey.biz.module.system.controller.engagement.task.vo.EngagementTaskRuleReqVO;
import cn.ey.biz.module.system.controller.engagement.task.vo.EngagementTaskRuleRespVO;
import cn.ey.biz.module.system.controller.engagement.task.vo.EngagementTaskRuleSimpleRespVO;
import cn.ey.biz.module.system.dal.dataobject.engagement.code.SystemEngagementCodeRuleDO;
import cn.ey.biz.module.system.dal.dataobject.engagement.task.SystemEngagementTaskRuleDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 任务生成规则 Convert
 */
@Mapper
public interface EngagementTaskRuleConvert {

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

    SystemEngagementTaskRuleDO convert(EngagementTaskRuleReqVO bean);

    List<SystemEngagementTaskRuleDO> taskRuleVoToDoConvert(List<EngagementTaskRuleReqVO> bean);
    @Mappings({
            @Mapping(expression = "java(ColumnFieldConverter.taskTypeToValue(dto.getTaskType()))", target = "taskTypeStr"),
    })
    EngagementTaskRuleRespVO dtoConvertVo(SystemEngagementTaskRuleDO dto);

    PageResult<EngagementTaskRuleRespVO> dtoConvertVoList(PageResult<SystemEngagementTaskRuleDO> dto);

    SystemEngagementTaskRuleDO voToDto(EngagementTaskRuleRespVO dto);

    List<EngagementTaskRuleSimpleRespVO> doConvertSimpleVo(List<SystemEngagementTaskRuleDO> taskRuleSimpleList);

    List<EngagementTaskRuleSimpleRespDTO> doConvertDto(List<SystemEngagementTaskRuleDO> list);

}
