"""Configuration for media file discovery and browser settings"""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/media/config.ipynb.

# %% auto 0
__all__ = ['MEDIA_CONFIG_SCHEMA', 'MediaConfig']

# %% ../../nbs/media/config.ipynb 3
from dataclasses import dataclass, field
from typing import List

# %% ../../nbs/media/config.ipynb 5
@dataclass
class MediaConfig:
    """Configuration for media file discovery and browser display."""
    # Directories to scan
    directories: List[str] = field(default_factory=list)  # Directories to scan for media files

    # File type filters (transcription-specific defaults)
    scan_audio: bool = True  # Include audio files in scan results
    scan_video: bool = True  # Include video files in scan results
    audio_extensions: List[str] = field(default_factory=lambda: [  # File extensions recognized as audio
        "mp3", "wav", "flac", "m4a", "ogg", "wma", "aac"
    ])
    video_extensions: List[str] = field(default_factory=lambda: [  # File extensions recognized as video
        "mp4", "mkv", "avi", "mov", "webm", "wmv"
    ])

    # Size limits
    min_file_size_kb: int = 0  # Minimum file size in KB (0 = no minimum)
    max_file_size_mb: int = 0  # Maximum file size in MB (0 = unlimited)

    # Scanning behavior
    recursive_scan: bool = True  # Scan subdirectories
    include_hidden: bool = False  # Include files starting with a dot
    follow_symlinks: bool = False  # Follow symbolic links when scanning
    exclude_patterns: List[str] = field(default_factory=list)  # Glob patterns to exclude

    # Caching
    cache_results: bool = True  # Cache scan results for faster loading
    cache_duration_minutes: int = 60  # How long to cache scan results

    # Display settings
    max_results: int = 1000  # Maximum number of files to return
    items_per_page: int = 30  # Number of files to show per page
    default_view: str = "list"  # Default view mode ("grid" or "list")
    sort_by: str = "name"  # Default sort field (name, size, modified)
    sort_descending: bool = False  # Sort in descending order

# %% ../../nbs/media/config.ipynb 7
MEDIA_CONFIG_SCHEMA = {
    "name": "media",
    "title": "Media Settings",
    "description": "Configure media file scanning and display",
    "type": "object",
    "properties": {
        "directories": {
            "type": "array",
            "title": "Scan Directories",
            "description": "Directories to scan for media files",
            "items": {"type": "string"},
            "default": []
        },
        "scan_audio": {
            "type": "boolean",
            "title": "Scan Audio Files",
            "description": "Include audio files in scan results",
            "default": True
        },
        "scan_video": {
            "type": "boolean",
            "title": "Scan Video Files",
            "description": "Include video files in scan results",
            "default": True
        },
        "audio_extensions": {
            "type": "array",
            "title": "Audio Extensions",
            "description": "File extensions to recognize as audio",
            "items": {"type": "string"},
            "default": ["mp3", "wav", "flac", "m4a", "ogg", "wma", "aac"]
        },
        "video_extensions": {
            "type": "array",
            "title": "Video Extensions",
            "description": "File extensions to recognize as video",
            "items": {"type": "string"},
            "default": ["mp4", "mkv", "avi", "mov", "webm", "wmv"]
        },
        "min_file_size_kb": {
            "type": "integer",
            "title": "Minimum File Size (KB)",
            "description": "Minimum file size in kilobytes (0 = no minimum)",
            "default": 0,
            "minimum": 0
        },
        "max_file_size_mb": {
            "type": "integer",
            "title": "Maximum File Size (MB)",
            "description": "Maximum file size in megabytes (0 = no limit)",
            "default": 0,
            "minimum": 0
        },
        "recursive_scan": {
            "type": "boolean",
            "title": "Recursive Scan",
            "description": "Scan subdirectories",
            "default": True
        },
        "include_hidden": {
            "type": "boolean",
            "title": "Include Hidden Files",
            "description": "Include files starting with a dot",
            "default": False
        },
        "follow_symlinks": {
            "type": "boolean",
            "title": "Follow Symlinks",
            "description": "Follow symbolic links when scanning",
            "default": False
        },
        "exclude_patterns": {
            "type": "array",
            "title": "Exclude Patterns",
            "description": "Glob patterns to exclude from results",
            "items": {"type": "string"},
            "default": []
        },
        "cache_results": {
            "type": "boolean",
            "title": "Cache Results",
            "description": "Cache scan results for faster loading",
            "default": True
        },
        "cache_duration_minutes": {
            "type": "integer",
            "title": "Cache Duration (minutes)",
            "description": "How long to cache scan results",
            "default": 60,
            "minimum": 1
        },
        "items_per_page": {
            "type": "integer",
            "title": "Items Per Page",
            "description": "Number of files to show per page",
            "default": 30,
            "minimum": 10,
            "maximum": 100
        },
        "default_view": {
            "type": "string",
            "title": "Default View",
            "description": "Default view mode for media browser",
            "enum": ["grid", "list"],
            "default": "grid"
        },
        "sort_by": {
            "type": "string",
            "title": "Sort By",
            "description": "Default sort field",
            "enum": ["name", "size", "modified"],
            "default": "name"
        },
        "sort_descending": {
            "type": "boolean",
            "title": "Sort Descending",
            "description": "Sort in descending order",
            "default": False
        }
    }
}
