"""
文档处理模块常量定义
统一管理分类代码、状态码等枚举值，消除硬编码字符串
"""

from enum import Enum


class CategoryCode(Enum):
    """一级分类代码"""
    BASIS = "basis"                      # 编制依据
    OVERVIEW = "overview"                # 工程概况
    PLAN = "plan"                        # 施工计划
    TECHNOLOGY = "technology"            # 施工工艺技术
    SAFETY = "safety"                    # 安全保证措施
    QUALITY = "quality"                  # 质量保证措施
    ENVIRONMENT = "environment"          # 环境保证措施
    management = "management"            # 施工管理及作业人员配备与分工
    ACCEPTANCE = "acceptance"            # 验收要求
    OTHER = "other"                      # 其他资料
    NON_STANDARD = "non_standard"        # 非标准项


class StatusCode(Enum):
    """处理状态码"""
    DOC_ANS_COMPLETED = "docu_ans_completed"
    PROCESSING = "processing"
    FAILED = "failed"
    COMPLETED = "completed"


class StageName(Enum):
    """处理阶段名称"""
    DOCUMENT_PARSING = "文档解析"
    TOC_EXTRACTION = "目录提取"
    CLASSIFICATION = "分类处理"
    TEXT_EXTRACTION = "文本提取"
    TEXT_SPLITTING = "文本切分"
    SECONDARY_CLASSIFICATION = "二级分类"
    TERTIARY_CLASSIFICATION = "三级分类"


# 一级分类中文名称映射
CATEGORY_CN_MAPPING = {
    CategoryCode.BASIS.value: "编制依据",
    CategoryCode.OVERVIEW.value: "工程概况",
    CategoryCode.PLAN.value: "施工计划",
    CategoryCode.TECHNOLOGY.value: "施工工艺技术",
    CategoryCode.SAFETY.value: "安全保证措施",
    CategoryCode.QUALITY.value: "质量保证措施",
    CategoryCode.ENVIRONMENT.value: "环境保证措施",
    CategoryCode.management.value: "施工管理及作业人员配备与分工",
    CategoryCode.ACCEPTANCE.value: "验收要求",
    CategoryCode.OTHER.value: "其他资料",
    CategoryCode.NON_STANDARD.value: "非标准项",
}


def get_category_cn(category_code: str) -> str:
    """获取分类的中文名称"""
    return CATEGORY_CN_MAPPING.get(category_code, "未知分类")