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

import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskInstanceVO;
import org.flowable.task.api.Task;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Arrays;

import static org.mapstruct.NullValueCheckStrategy.ALWAYS;

/**
 * 运行中的审批任务的 MapStruts 转换器
 *
 * @author wangli
 * @since 2023/7/29 23:23
 */
@Mapper(
        componentModel = "spring",
        nullValueCheckStrategy = ALWAYS,
        imports = Arrays.class
)
public interface BpmnTaskConverter extends EntityConverter<BpmnTaskInstanceVO, Task> {
    @Mapping(target = "processInstanceId", source = "processInstanceId")
    @Mapping(target = "processDefinitionId", source = "processDefinitionId")
    @Mapping(target = "taskId", source = "id")
    @Mapping(target = "taskDefinitionKey", source = "taskDefinitionKey")
    @Mapping(target = "name", source = "name")
    @Mapping(target = "owner", source = "owner")
    @Mapping(target = "createTime", source = "createTime")
    @Mapping(target = "tenantId", source = "tenantId")
    @Mapping(target = "formKey", source = "formKey")
    @Mapping(target = "category", source = "category")
    @Override
    BpmnTaskInstanceVO toVo(Task entity);
}
