package com.friday.distributor.po;

import com.friday.distributor.constant.States;
import com.friday.operation.api.distributor.dto.TaieTaskDto;
import com.friday.blank.api.constants.BusinessTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @Author YaoYao
 * @Date Created In 17:33 2023/2/27
 * @Description
 * @Modified By
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TaskInvoke {
    /**
     * 主键ID
     */
    private Integer id;
    /**
     * TAIE用户租户key
     */
    private String taieTenant;
    /**
     * 任务类型唯一标志
     */
    private String taskType;
    /**
     * 任务类型{@link BusinessTypeEnum}
     */
    private String bizType;
    /**
     * 任务执行记录uuid
     */
    private String taskId;
    /**
     * 任务版本
     */
    private String taskVersion;
    /**
     * 任务级入参
     */
    private String taskInput;
    /**
     * 任务级出参
     */
    private String taskOutput;
    /**
     * 任务级业务参数
     */
    private String taskBizData;
    /**
     * 任务状态
     * {@link States.TaskState}
     */
    private String taskState;
    /**
     * 操作人
     */
    private String operator;
    /**
     * 调用系统
     */
    private String sysCode;
    /**
     * 是否有效
     */
    private Boolean valid;
    /**
     * 备注
     */
    private String remark;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    public TaieTaskDto transferToTaieTaskDto(){
        return TaieTaskDto.builder()
                .taieTenant(taieTenant)
                .bizType(bizType)
                .taskType(taskType)
                .taskId(taskId)
                .taskVersion(taskVersion)
                .taskInput(taskInput)
                .taskOutput(taskOutput)
                .taskBizData(taskBizData)
                .taskState(taskState)
                .operator(operator)
                .sysCode(sysCode)
                .build();
    }
}
