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

class Destination(BaseModel):
    id: str = Field(default_factory=lambda: str(uuid.uuid4()))
    name: str
    location: str
    description: str
    image: str
    category: str  # City, Beach, Adventure
    rating: float
    price: float
    currency: str = "USD"
    created_at: datetime = Field(default_factory=datetime.utcnow)

class DestinationCreate(BaseModel):
    name: str
    location: str
    description: str
    image: str
    category: str
    rating: float
    price: float
    currency: str = "USD"

class DestinationUpdate(BaseModel):
    name: Optional[str] = None
    location: Optional[str] = None
    description: Optional[str] = None
    image: Optional[str] = None
    category: Optional[str] = None
    rating: Optional[float] = None
    price: Optional[float] = None
    currency: Optional[str] = None

class Special(BaseModel):
    id: str = Field(default_factory=lambda: str(uuid.uuid4()))
    destination_id: str
    discount: float
    end_date: str  # ISO format date
    highlights: List[str]
    created_at: datetime = Field(default_factory=datetime.utcnow)

class SpecialCreate(BaseModel):
    destination_id: str
    discount: float
    end_date: str
    highlights: List[str]

class SpecialUpdate(BaseModel):
    discount: Optional[float] = None
    end_date: Optional[str] = None
    highlights: Optional[List[str]] = None

class AdminUser(BaseModel):
    id: str = Field(default_factory=lambda: str(uuid.uuid4()))
    email: str
    password_hash: str
    created_at: datetime = Field(default_factory=datetime.utcnow)

class AdminLogin(BaseModel):
    email: str
    password: str

class Contact(BaseModel):
    id: str = Field(default_factory=lambda: str(uuid.uuid4()))
    name: str
    email: str
    message: str
    created_at: datetime = Field(default_factory=datetime.utcnow)

class ContactCreate(BaseModel):
    name: str
    email: str
    message: str

class NewsletterSubscriber(BaseModel):
    id: str = Field(default_factory=lambda: str(uuid.uuid4()))
    email: str
    subscribed_at: datetime = Field(default_factory=datetime.utcnow)

class NewsletterSubscribe(BaseModel):
    email: str
