"""Input validation utilities."""

import re
from typing import List, Tuple

from ..models.request import TracklistEntry


def validate_tracklist(tracklist: List[TracklistEntry]) -> Tuple[bool, List[str]]:
    """
    Validate a tracklist and return any errors.

    Returns:
        (is_valid, error_messages)
    """
    errors = []
    for idx, entry in enumerate(tracklist, 1):
        # Each entry must have a timestamp
        if not entry.ts or not entry.ts.strip():
            errors.append(f"Line {idx}: Missing timestamp (%ts)")
        # Additional validation could be added here

    return len(errors) == 0, errors