from __future__ import annotations

from enum import StrEnum


class ModuleProjectStatusEnum(StrEnum):
    """通用模块项目状态。"""

    PENDING = "pending"
    WAITING_USER = "waiting_user"
    PROCESSING = "processing"
    COMPLETED = "completed"
    FAILED = "failed"
    CANCELLED = "cancelled"


class ModuleStepStatusEnum(StrEnum):
    """通用模块子任务状态。"""

    PENDING = "pending"
    WAITING_USER = "waiting_user"
    PROCESSING = "processing"
    COMPLETED = "completed"
    FAILED = "failed"
    CANCELLED = "cancelled"


class ModuleEventTypeEnum(StrEnum):
    """通用模块事件类型。"""

    PROJECT_CREATED = "PROJECT_CREATED"
    PROJECT_DELETED = "PROJECT_DELETED"
    STEP_CREATED = "STEP_CREATED"
    STEP_UPDATED = "STEP_UPDATED"
    SOFT_DELETE_STEPS = "SOFT_DELETE_STEPS"
    IMAGE_PROMPT_SUBMITTED = "IMAGE_PROMPT_SUBMITTED"
    IMAGE_PROMPT_SUCCESS = "IMAGE_PROMPT_SUCCESS"
    IMAGE_PROMPT_FAILED = "IMAGE_PROMPT_FAILED"
    IMAGE_GENERATE_SUBMITTED = "IMAGE_GENERATE_SUBMITTED"
    IMAGE_GENERATE_SUCCESS = "IMAGE_GENERATE_SUCCESS"
    VIDEO_PROMPT_SUBMITTED = "VIDEO_PROMPT_SUBMITTED"
    VIDEO_PROMPT_SUCCESS = "VIDEO_PROMPT_SUCCESS"
    VIDEO_PROMPT_FAILED = "VIDEO_PROMPT_FAILED"
    VIDEO_GENERATE_SUBMITTED = "VIDEO_GENERATE_SUBMITTED"
    VIDEO_GENERATE_SUCCESS = "VIDEO_GENERATE_SUCCESS"
    CHAT_TASK_FAILED = "CHAT_TASK_FAILED"
    CHAT_TASK_CANCELLED = "CHAT_TASK_CANCELLED"
    MEDIA_REFUND = "MEDIA_REFUND"
    PROMPT_BILLING_SUCCESS = "PROMPT_BILLING_SUCCESS"
    PROMPT_BILLING_FAILED = "PROMPT_BILLING_FAILED"


class ModulePromptTypeEnum(StrEnum):
    """通用模块提词结果类型。"""

    IMAGE_PROMPT = "image_prompt"
    VIDEO_PROMPT = "video_prompt"


# 视频提词 Schema 管理后台配置
VIDEO_SCHEMA_CONFIG_KEY = "video_prompt_schema_config"
VIDEO_SCHEMA_CONFIG_DESCRIPTION = "视频提词 Schema 管理后台配置"
VIDEO_SCHEMA_CONFIG_VERSION = "video_prompt_schema_config_v1"
VIDEO_SCHEMA_CONFIG_DEFAULT_SOURCE = "default"
VIDEO_SCHEMA_CONFIG_DATABASE_SOURCE = "database"

# 仅用于管理后台配置项和用户可编辑字段校验；AI 生成结果与最终视频 prompt 不做自动裁剪。
VIDEO_SCHEMA_CONFIG_KEY_MAX_LEN = 64
VIDEO_SCHEMA_CONFIG_LABEL_MAX_LEN = 64
VIDEO_SCHEMA_CONFIG_DESC_MAX_LEN = 300
VIDEO_SCHEMA_EDITABLE_TEXT_MAX_LEN = 1000
VIDEO_SCHEMA_FLOW_CONTENT_MAX_LEN = 800
VIDEO_SCHEMA_TIME_STAGE_MAX_LEN = 64
VIDEO_SCHEMA_TIME_DESC_MAX_LEN = 300
VIDEO_SCHEMA_MAX_SECTION_COUNT = 40
VIDEO_SCHEMA_MAX_FIELD_COUNT_PER_SECTION = 80
VIDEO_SCHEMA_MAX_TIME_RULE_COUNT = 30
VIDEO_SCHEMA_MAX_SEGMENT_COUNT_PER_RULE = 12
