package com.malk.aiwei.server;

import com.alibaba.fastjson.JSON;
import com.malk.utils.UtilHttp;
import com.malk.utils.UtilMap;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AWServer {

    /**
     * 任务卡片字段名称
     */
    public static final String TASK_ROLE = "资源名称";
    public static final String TASK_CODE = "任务编号";
    public static final String TASK_STAGE = "TR评审节点";
    public static final String TASK_STAGE_BLANK = "无TR评审节点";
    public static final String TASK_PRODUCT = "产品型号";
    public static final String TASK_PRODUCT_VERSION = "产品版本";
    public static final String TASK_WAFER = "wafer";

    public static final String TASK_TRANSMIT = "下达状态";

    // prd 23.02.29 字段从 预检项 变更为 技术检查项
    public static final String TASK_CHECK_LINK = "技术检查项";
    public static final String TASK_CHECK_STATUS = "技术检查项检查状态";

    // prd 7.17 技术检查项确认状态
    public static final String TASK_CHECK_LINK_OK = "技术检查确认";

    public static final String TASK_APPROVE_ATTACHMENT = "交付件";
    public static final String TASK_APPROVE_VERSION = "交付件版本";
    public static final String TASK_APPROVE_LINK = "交付件审批流程";
    public static final String TASK_APPROVE_STATE = "变更状态";
    public static final String TASK_APPROVE_DESC = "交付件描述";

    // prd 8.6 产品型号、版本选择添加字段
    public static final String SELECT_TASK_PRODUCT = "选择产品型号";
    public static final String SELECT_TASK_PRODUCT_VERSION = "选择产品版本";

    // ppExt: 注意不同任务类型名称唯一性, 如通用已完成不要使用
    public static final String WORKFLOW_APPROVE = "已提交";
    public static final List<String> WORKFLOW_INITIAL = Arrays.asList("未完成", "待处理");

    public static final String PROJECT_PM_ROLE = "项目管理员";
    public static final String PROJECT_PM_NAME = "项目经理";

    // 预检项不加载白名单 [项目模板/供复制项目]
    public static final List<String> PROJECT_IGNORE_ID = Arrays.asList(
            "65fac2fc386eb113f1adac83", // ak类正式模板
            "65fac3af386eb113f1adacc0", // ak类迁移模板
            "65f269605a2065ad7ad65d18"  // ak类复制项目
    );

    /**
     * 艾为网关接口
     */
    private static final String appKey = "AW394034j";
    private static final String secret = "RJbH7RMH3vllt4KDri303Mlw@df3434k";

    public static String getToken() {

        Map body = UtilMap.map("appKey, secret", appKey, secret);
        String rsp = UtilHttp.doPost("https://apigateway.awinic.com/token/getToken", null, body, new HashMap());
        Map result = (Map) JSON.parse(rsp);
        return UtilMap.getString(result, "token");
    }
}
