from pydantic import BaseModel, Field
from typing import Optional, Dict, Any
from datetime import datetime

class SystemSettingBase(BaseModel):
    key: str = Field(..., description="Clé unique du paramètre")
    value: str = Field(..., description="Valeur du paramètre")
    description: Optional[str] = Field(None, description="Description du paramètre")
    category: str = Field(default="general", description="Catégorie du paramètre")

class SystemSettingCreate(SystemSettingBase):
    pass

class SystemSettingUpdate(BaseModel):
    value: str = Field(..., description="Nouvelle valeur du paramètre")

class SystemSettingResponse(SystemSettingBase):
    id: int
    is_editable: bool
    created_at: datetime
    updated_at: datetime
    
    class Config:
        from_attributes = True

class SettingsCategoryResponse(BaseModel):
    category: str
    settings: list[SystemSettingResponse]
    
    class Config:
        from_attributes = True

class UploadLimitsResponse(BaseModel):
    max_album_size_mb: int
    max_vlog_size_mb: int
    max_image_size_mb: int
    max_video_size_mb: int
    max_media_per_album: int
    allowed_image_types: list[str]
    allowed_video_types: list[str]
