"""Prompt building for enhancement service."""

from typing import Dict, Any


def build_enhancement_prompt(transcript: str, config: Dict[str, Any], **kwargs) -> str:
    """Build the enhancement prompt.

    Args:
        transcript: Raw transcript
        config: Enhancement configuration
        **kwargs: Additional context

    Returns:
        Formatted prompt for DeepSeek

    """
    context = kwargs.get("context", "")
    preserve_timestamps = kwargs.get("preserve_timestamps", config.get("preserve_timestamps", True))
    preserve_speaker_markers = kwargs.get("preserve_speaker_markers", config.get("preserve_speaker_markers", True))

    prompt_parts = [
        "Enhance the following transcript by:",
        "1. Correcting punctuation and capitalization",
        "2. Fixing technical terms and proper nouns",
        "3. Formatting into readable paragraphs",
    ]

    if preserve_timestamps:
        prompt_parts.append("4. Preserving timestamps (e.g., [00:01:23])")
    
    if preserve_speaker_markers:
        prompt_parts.append("5. Preserving speaker markers (e.g., Speaker 1:, Speaker 2:)")

    prompt_parts.extend([
        "6. Maintaining original meaning and structure",
        "7. Preserving numbers and technical accuracy",
        "",
        "Return ONLY the enhanced transcript without any explanations or markdown formatting."
    ])

    if context:
        prompt_parts.insert(0, f"Context: {context}")
        prompt_parts.insert(1, "")

    prompt_parts.extend([
        "",
        "Transcript:",
        transcript
    ])

    return "\n".join(prompt_parts)
