package cn.axzo.workflow.core.service.converter;

import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricCommentVO;
import org.flowable.engine.task.Comment;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Arrays;

import static org.mapstruct.NullValueCheckStrategy.ALWAYS;

/**
 * 任务评论 MapStruts 转换器
 *
 * @author wangli
 * @since 2023/7/30 13:30
 */
@Mapper(
        componentModel = "spring",
        nullValueCheckStrategy = ALWAYS,
        imports = Arrays.class
)
public interface BpmnHistoricCommentConverter extends EntityConverter<BpmnHistoricCommentVO, Comment> {

    @Mapping(target = "id", source = "id")
    @Mapping(target = "type", source = "type")
    @Mapping(target = "userId", source = "userId")
    @Mapping(target = "taskId", source = "taskId")
    @Mapping(target = "createTime", source = "time")
    @Mapping(target = "processInstanceId", source = "processInstanceId")
    @Mapping(target = "message", source = "fullMessage")
    @Override
    BpmnHistoricCommentVO toVo(Comment entity);
}
