package com.friday.tooldriver.constants.uipath;

import java.util.Arrays;

/**
 * UiPath任务执行状态说明
 */
public enum UiPathTaskRunStatusEnum {
    PENDING("Pending","挂起"),
    RUNNING("Running","运行"),
    STOPPING("Stopping","停止"),
    TERMINATING("Terminating","终止"),
    FAULTED("Faulted","出错"),
    SUCCESSFUL("Successful","成功"),
    STOPPED("Stopped","停止"),
    SUSPENDED("Suspended","挂起"),
    RESUMED("Resumed","恢复");

    private String code;
    private String meaning;

    UiPathTaskRunStatusEnum(String code, String meaning) {
        this.code = code;
        this.meaning = meaning;
    }

    public String getCode() {
        return code;
    }

    public String getMeaning() {
        return meaning;
    }

    public static String getMeaningByCode(String code){
        return Arrays.stream(values()).filter(taskRunStatus ->taskRunStatus.getCode().equals(code)).map(UiPathTaskRunStatusEnum::getMeaning).findFirst().orElse("");
    }

}
