package cn.stylefeng.team.project.api.enums;

import lombok.Getter;

@Getter
public enum SystemCodeTypeEnum {

    APPLICATION("PRO", "devops_project"),

    BUSINESS("BIZ", "devops_business"),

    MODEL("TB", "devops_meta_model"),

    FORM("FM", "devops_form_model"),

    VIEW("VIEW", "devops_view"),

    REPORT("REPORT", "devops_report"),

    REQUIREMENT("REQU", "devops_project_dev_item"),

    TASK("TASK", "devops_project_dev_item"),

    STASK("STASK", "devops_project_dev_item"),

    BUG("BUG", "devops_project_dev_item"),

    EVALUATION("EV", "devops_project_evaluation"),

    BUSINESS_DIAGRAM("BD", "devops_business_diagram"),

    PROJECT_VERSION("W", "devops_project_version"),

    PROJECT_ITERATION("W", "devops_project_iteration"),

    TEST_MODULE("W", "devops_work_item_test_module"),

    TEST_CASE("W", "devops_work_item_test_case"),

    AUDIT_RECORD_CARD("W", "docx_audit_record_card"),

    COMMUNICATION_RECORD("W", "docx_communication_record"),

    DESIGN_CONFIRM_RECORD("W", "docx_design_confirm_record"),

    DESIGN_DOCUMENT_OUTPUT_APPROVAL("W", "docx_design_document_output_approval"),

    DESIGN_PRODUCT_OUTPUT_CHECK_RECORD("W", "docx_design_product_output_check_record"),

    DESIGN_REVIEW_APPROVAL("W", "docx_design_review_approval"),

    DIRECTOR_APPROVAL("W", "docx_director_approval"),

    GENERAL_CONTRACT_REVIEW("W", "docx_general_contract_review"),

    PHUMAN_RESOURCE_PAN("W", "docx_phuman_resource_pan"),

    PRODUCT_MANAGER_APPROVE("W", "docx_product_manager_approve"),

    PROFESSIONAL_ITEM_PERFORMANCE_STATISTICS("W", "docx_professional_item_performance_statistics"),

    PROGRAM_REVIEW_RECORD("W", "docx_program_review_record"),

    PROJECT_LEVEL_REGISTER("W", "docx_project_level_register"),

    PROJECT_TECHNICAL_SERVICE("W", "docx_project_technical_service"),

    DEVOPS_WORK_PROBLEM("p", "devops_work_problem"),

    DEVOPS_WORK_ORDER("W", "devops_work_order");

    private final String appCode;

    private final String tableName;

    SystemCodeTypeEnum(String appCode, String tableName) {
        this.appCode = appCode;
        this.tableName = tableName;
    }

    public static SystemCodeTypeEnum codeToEnum(String code) {
        if (null != code) {
            for (SystemCodeTypeEnum e : SystemCodeTypeEnum.values()) {
                if (e.getAppCode().equals(code)) {
                    return e;
                }
            }
        }
        return null;
    }

}
