from pydantic import BaseModel, EmailStr, Field, field_validator

class ContactCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=255)
    email: EmailStr
    subject: str = Field(..., min_length=1, max_length=255)
    message: str = Field(..., min_length=1)

    @field_validator('name', 'subject', 'message')
    @classmethod
    def strip_whitespace(cls, v):
        return v.strip() if isinstance(v, str) else v

class ContactResponse(BaseModel):
    success: bool
    message: str
