"""
Hatchet workflow constants.
"""

from enum import StrEnum


class TaskName(StrEnum):
    GET_RECORDING = "get_recording"
    GET_PARTICIPANTS = "get_participants"
    PROCESS_TRACKS = "process_tracks"
    MIXDOWN_TRACKS = "mixdown_tracks"
    GENERATE_WAVEFORM = "generate_waveform"
    DETECT_TOPICS = "detect_topics"
    GENERATE_TITLE = "generate_title"
    EXTRACT_SUBJECTS = "extract_subjects"
    PROCESS_SUBJECTS = "process_subjects"
    GENERATE_RECAP = "generate_recap"
    IDENTIFY_ACTION_ITEMS = "identify_action_items"
    FINALIZE = "finalize"
    CLEANUP_CONSENT = "cleanup_consent"
    POST_ZULIP = "post_zulip"
    SEND_WEBHOOK = "send_webhook"
    SEND_EMAIL = "send_email"
    PAD_TRACK = "pad_track"
    TRANSCRIBE_TRACK = "transcribe_track"
    DETECT_CHUNK_TOPIC = "detect_chunk_topic"
    GENERATE_DETAILED_SUMMARY = "generate_detailed_summary"

    # File pipeline tasks
    EXTRACT_AUDIO = "extract_audio"
    UPLOAD_AUDIO = "upload_audio"
    TRANSCRIBE = "transcribe"
    DIARIZE = "diarize"
    ASSEMBLE_TRANSCRIPT = "assemble_transcript"
    GENERATE_SUMMARIES = "generate_summaries"

    # Live post-processing pipeline tasks
    WAVEFORM = "waveform"
    CONVERT_MP3 = "convert_mp3"
    UPLOAD_MP3 = "upload_mp3"
    REMOVE_UPLOAD = "remove_upload"
    FINAL_SUMMARIES = "final_summaries"


# Rate limit key for LLM API calls (shared across all LLM-calling tasks)
LLM_RATE_LIMIT_KEY = "llm"

# Max LLM calls per second across all tasks
LLM_RATE_LIMIT_PER_SECOND = 10

# Task execution timeouts (seconds)
TIMEOUT_SHORT = 60  # Quick operations: API calls, DB updates
TIMEOUT_MEDIUM = (
    300  # Single LLM calls, waveform generation (5m for slow LLM responses)
)
TIMEOUT_LONG = 180  # Action items (larger context LLM)
TIMEOUT_TITLE = 300  # generate_title (single LLM call; doc: reduce from 600s)
TIMEOUT_AUDIO = 720  # Audio processing: padding, mixdown (Hatchet execution_timeout)
TIMEOUT_AUDIO_HTTP = (
    660  # httpx timeout for pad_track — below 720 so Hatchet doesn't race
)
TIMEOUT_HEAVY = 1200  # Transcription, fan-out LLM tasks (Hatchet execution_timeout)
TIMEOUT_HEAVY_HTTP = (
    1150  # httpx timeout for transcribe_track — below 1200 so Hatchet doesn't race
)
TIMEOUT_EXTRA_HEAVY = (
    3600  # Detect Topics, fan-out LLM tasks (Hatchet execution_timeout)
)
TIMEOUT_EXTRA_HEAVY_HTTP = (
    3400  # httpx timeout for detect_topics — below 3600 so Hatchet doesn't race
)
