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


class ContactMessageCreate(BaseModel):
    full_name: str
    email: EmailStr
    phone: Optional[str] = None
    subject: str
    message: str


class ContactMessageUpdate(BaseModel):
    is_read: Optional[bool] = None
    status: Optional[str] = None  # new, read, replied
    admin_notes: Optional[str] = None


class ContactMessageResponse(BaseModel):
    id: int
    full_name: str
    email: str
    phone: Optional[str]
    subject: str
    message: str
    created_at: datetime
    is_read: bool
    status: str
    admin_notes: Optional[str]

    class Config:
        from_attributes = True
