package com.microservices.pms.utils;

import com.microservices.common.core.enums.SystemRole;

/**
 * @author otto
 */
public class PmsConstants {
    public final static Integer TRUE = 1;
    public final static Integer FALSE = 0;
    /**
     * 用户不在组织时返回的信息
     */
    public final static String USER_NOT_IN_ORG_MSG = "组织成员不存在";

    /**
     * （状态/优先级）产品计划类型
     */
    public final static Integer PRODUCT_STATUS_OR_PRIORITY_PLAN_TYPE = 1;
    /**
     * （状态/优先级）产品需求类型
     */
    public final static Integer PRODUCT_STATUS_OR_PRIORITY_REQUIREMENT_TYPE = 2;
    /**
     * 产品计划状态-未启动
     */
    public final static String PRODUCT_PLAN_NOT_STARTED_STATUS_NAME = "未启动";
    /**
     * 产品计划状态-进行中
     */
    public final static String PRODUCT_PLAN_IN_PROGRESS_STATUS_NAME = "进行中";
    /**
     * 产品计划状态-已过期
     */
    public final static String PRODUCT_PLAN_EXPIRED_STATUS_NAME = "已过期";
    /**
     * 产品计划状态-已完成
     */
    public final static String PRODUCT_PLAN_COMPLETED_STATUS_NAME = "已完成";
    /**
     * 产品计划状态-已关闭
     */
    public final static String PRODUCT_PLAN_CLOSED_STATUS_NAME = "已关闭";
    /**
     * 评论类型-产品需求
     */
    public final static String JOURNAL_TYPE_PRODUCT_REQUIREMENT = "productRequirement";

    /**
     * 评论类型-测试单执行用例
     */
    public final static String JOURNAL_TYPE_PROJECT_TESTSHEET_CASES = "projectTestsheetCases";
    /**
     * GitLink响应总数Key
     */
    public final static String GITLINK_RESPONSE_TOTAL_COUNT_KEY = "total_count";
    /**
     * GitLink项目列表Key
     */
    public final static String GITLINK_RESPONSE_PROJECTS_KEY = "projects";
    /**
     * GitLink组织中Owner团队
     */
    public final static String GITLINK_ORGANIZATION_AUTHORIZE_OWNER_TEAM = "owner";
    /**
     * 标记和模块类型-产品
     */
    public final static Integer PRODUCT_TAG_AND_MODULE_TYPE = 1;
    /**
     * 标记和模块类型-测试用例
     */
    public final static Integer TESTCASE_TAG_AND_MODULE_TYPE = 2;

    /**
     *  模块类型-测试单
     */
    public final static Integer TESTSHEET_TAG_AND_MODULE_TYPE = 3;

    /**
     * 1 迭代及工作项完成
     */
    public final static Integer SPRINT_AND_ISSUES_COMPLETE_TYPE = 1;

    /**
     * 2 迭代完成，工作项批量为未规划
     */
    public final static Integer SPRINT_COMPLETE_ISSUES_UNPLANNED_TYPE = 2;

    /**
     * 3 迭代完成，工作项批量转移到其他迭代
     */
    public final static Integer SPRINT_COMPLETE_ISSUES_TRANSFER_TO_OTHER_TYPE = 3;

    /**
     * 状态 0待开始
     */
    public final static String SPRINT_TO_BE_STARTED_STATUS = "0";

    /**
     * 状态 1进行中
     */
    public final static String SPRINT_IN_PROGRESS_STATUS = "1";

    /**
     * 状态 2已关闭
     */
    public final static String SPRINT_CLOSED_STATUS = "2";

    /**
     *  项目工作项——需求类型
     */
    public final static String PROJECT_ISSUE_TYPE_REQUIREMENT = "1";

    /**
     *  项目工作项——任务类型
     */
    public final static String PROJECT_ISSUE_TYPE_TASK = "2";

    /**
     *  项目工作项——缺陷类型
     */
    public final static String PROJECT_ISSUE_TYPE_BUG = "3";

    /**
     *  项目工作项——周报类型
     */
    public final static String PROJECT_ISSUE_TYPE_WEEKLY_REPORT = "4";

    /**
     *  疑修筛选类型-全部
     */
    public final static String ISSUE_FILTER_TYPE_ALL = "all";

    /**
     * Gitlink组织团队-项目管理员团队
     */
    public final static String GITLINK_ORGANIZATION_TEAM_ADMIN = "pmsProjectAdmin";

    /**
     * Gitlink组织团队-普通成员团队
     */
    public final static String GITLINK_ORGANIZATION_TEAM_WRITE = "pmsUser";

    /**
     * Gitlink组织团队-OWNER团队
     */
    public final static String GITLINK_ORGANIZATION_TEAM_OWNER = "owner";

    public static String getGitlinkOrgTeamKeyByRoleKey(String roleKey) {
        String gitlinkOrgTeamKey = GITLINK_ORGANIZATION_TEAM_WRITE;
        if (SystemRole.PMS_ORG_ADMIN.getRoleKey().equals(roleKey)) {
            gitlinkOrgTeamKey = PmsConstants.GITLINK_ORGANIZATION_TEAM_OWNER;
        }
        if (SystemRole.PMS_PROJECT_MANAGER.getRoleKey().equals(roleKey)) {
            gitlinkOrgTeamKey = PmsConstants.GITLINK_ORGANIZATION_TEAM_ADMIN;
        }
        return gitlinkOrgTeamKey;
    }

    public final static String PIPELINE_FILE_DIRECTORY = ".gitea/workflows/";

    public final static String PIPELINE_YML_FILE_SUFFIX = ".yml";

    public final static String PIPELINE_ENABLE_STATUS = "enable";
    public final static String PIPELINE_DISABLE_STATUS = "disable";

    /**
     * 流水线类型：声明式
     */
    public final static Integer PIPELINE_TYPE_CODE = 1;

    /**
     * 流水线类型：图形化
     */
    public final static Integer PIPELINE_TYPE_GRAPHIC = 2;
}
