package com.friday.tooldriver.dto.uipath.response;

import com.alibaba.fastjson.annotation.JSONField;

import com.friday.operation.api.tooldriver.dto.rpa.ReleaseDto;
import com.friday.tooldriver.dto.uipath.request.ArgumentMetadata;
import com.friday.tooldriver.dto.uipath.request.EnvironmentDto;
import com.friday.tooldriver.dto.uipath.request.ReleaseVersionDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ReleaseResponseDto implements Serializable {
    //uuid:启动入参
    private String key;
    //代码包名称(唯一)
    private String processKey;
    //流程版本
    private String processVersion;
    //是否为最新版本
    @JSONField(name = "isLatestVersion")
    private boolean latestVersion;
    //代码包是否删除
    @JSONField(name = "isProcessDeleted")
    private boolean processDeleted;
    //描述
    private String description;
    //流程名(旧式文件夹默认为代码包名_环境名,新式文件夹默认为代码包名)
    private String name;
    @Deprecated
    private int environmentId;
    @Deprecated
    private String environmentName;
    @Deprecated
    private EnvironmentDto environment;
    //入参
    private String inputArguments;
    //版本信息
    private ReleaseVersionDto currentVersion;
    //已发布版本
    private List<ReleaseVersionDto> releaseVersions;
    //入参元数据
    private ArgumentMetadata arguments;
    //ID
    private int id;

    public ReleaseDto transferToReleaseDto(){
        return ReleaseDto.builder()
                .key(String.valueOf(id))
                .name(name)
                .processVersion(processVersion)
                .latestVersion(latestVersion)
                .description(description)
                .build();
    }
}