package com.friday.operation.api.tooldriver.dto.rpa;

import com.alibaba.fastjson.JSONObject;
import com.friday.operation.api.tooldriver.constant.LicenseTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Author YaoYao
 * @Date Created In 11:28 2022/12/1
 * @Description 许可数据结构
 * @Modified By
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class LicenseDto implements Serializable {
    /**
     * 许可值
     */
    private String licenseKey;
    /**
     * 机器人键值
     */
    private String robotKey;
    /**
     * whoAmI
     */
    private String whoAmI;
    /**
     * 许可类型{@link LicenseTypeEnum}
     */
    private String licenseType;
    /**
     * 其它信息
     */
    private JSONObject extInfo;

    public boolean attendedLicense(){
        return LicenseTypeEnum.Attended.getType().equals(licenseType) ||
                LicenseTypeEnum.Studio.getType().equals(licenseType) ||
                LicenseTypeEnum.StudioX.getType().equals(licenseType) ||
                LicenseTypeEnum.Development.getType().equals(licenseType) ||
                LicenseTypeEnum.StudioPro.getType().equals(licenseType);
    }

    public boolean unattendedLicense(){
        return LicenseTypeEnum.NonProduction.getType().equals(licenseType) ||
                LicenseTypeEnum.Unattended.getType().equals(licenseType) ||
                LicenseTypeEnum.Headless.getType().equals(licenseType) ||
                LicenseTypeEnum.TestAutomation.getType().equals(licenseType);
    }

}
