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

import com.alibaba.fastjson.annotation.JSONField;
import com.friday.operation.api.tooldriver.dto.rpa.ReleaseDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ProcessReleaseDto implements Serializable {
    @JSONField(name = "Key")
    private String key;
    @JSONField(name = "Name")
    private String name;
    @JSONField(name = "Description")
    private String description;
    @JSONField(name = "ProcessKey")
    private String processKey;
    @JSONField(name = "ProcessVersion")
    private String processVersion;
    @JSONField(name = "IsLatestVersion")
    private Boolean isLatestVersion;
    @JSONField(name = "IsProcessDeleted")
    private Boolean isProcessDeleted;
    @JSONField(name = "InputArguments")
    private String inputArguments;
    @JSONField(name = "JobPriority")
    private String jobPriority;
    @JSONField(name = "OrganizationUnitId")
    private int organizationUnitId;
    @JSONField(name = "Id")
    private int id;
    @JSONField(name = "ProcessSettings")
    private ProcessSettingDto processSettings;

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