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


class GlobalSettingBase(BaseModel):
    setting_key: str = Field(..., max_length=100)
    setting_value: str
    description: Optional[str] = None


class GlobalSettingCreate(GlobalSettingBase):
    pass


class GlobalSettingUpdate(BaseModel):
    setting_value: str
    description: Optional[str] = None


class GlobalSetting(GlobalSettingBase):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True


class UploadLimitResponse(BaseModel):
    upload_limit_mb: int
    description: str


class UploadLimitUpdate(BaseModel):
    upload_limit_mb: int = Field(..., ge=1, le=10000, description="Upload limit in MB (1-10000)")