import uuid
from datetime import datetime
from enum import Enum
from typing import Optional

from pydantic import BaseModel, Field


class ReactionType(str, Enum):
    POSITIVE = "positive"
    NEUTRAL = "neutral"
    NEGATIVE = "negative"


class FeedbackCategory(str, Enum):
    BUG = "bug"
    FEATURE = "feature"
    CONFUSING = "confusing"
    PRAISE = "praise"


class BetaFeedbackCreate(BaseModel):
    reaction: ReactionType
    category: Optional[FeedbackCategory] = None
    text: Optional[str] = Field(None, max_length=5000)
    page_url: Optional[str] = Field(None, max_length=500)
    session_id: Optional[str] = Field(None, max_length=100)


class BetaFeedbackResponse(BaseModel):
    id: uuid.UUID
    user_id: uuid.UUID
    reaction: str
    category: Optional[str] = None
    text: Optional[str] = None
    page_url: Optional[str] = None
    session_id: Optional[str] = None
    created_at: datetime

    model_config = {"from_attributes": True}
