from datetime import datetime
from typing import List, Optional

from pydantic import UUID4, BaseModel, Field


class UserRatingReview(BaseModel):
    """Оценка ревью от пользователя"""

    user_id: UUID4
    rating: float = Field(ge=0, le=10)


class ReviewModel(BaseModel):
    """Модель рецензии к фильму"""

    id: str
    text: str = Field(min_length=20)
    created_at: datetime = datetime.now()
    user_id: UUID4
    movie_id: UUID4
    user_rating_review: List[Optional[UserRatingReview]] = Field(default_factory=list)
    rating: float = Field(ge=0, le=10)
