#!/usr/bin/env python3
"""
视频验证器实现
"""

import logging
from pathlib import Path
from .types import ValidationError

logger = logging.getLogger(__name__)

class BasicVideoValidator:
    """基础视频验证器"""
    
    SUPPORTED_EXTENSIONS = {'.mp4', '.avi', '.mov', '.mkv', '.wmv', '.flv', '.webm'}
    
    def validate(self, video_path: str) -> bool:
        """验证视频文件"""
        path = Path(video_path)
        
        # 检查文件存在
        if not path.exists():
            raise ValidationError(f"Video file not found: {video_path}")
        
        # 检查是否为文件
        if not path.is_file():
            raise ValidationError(f"Path is not a file: {video_path}")
        
        # 检查扩展名
        if path.suffix.lower() not in self.SUPPORTED_EXTENSIONS:
            logger.warning(f"Unsupported video extension: {path.suffix}")
        
        # 检查文件大小
        if path.stat().st_size == 0:
            raise ValidationError(f"Video file is empty: {video_path}")
        
        return True
