"""
Question Schemas
"""
from datetime import datetime
from typing import Optional
from uuid import UUID
from pydantic import BaseModel, ConfigDict, Field


class QuestionBase(BaseModel):
    """Base question schema"""
    content: str = Field(..., min_length=1)
    answer: Optional[str] = None
    question_type: Optional[str] = Field(None, max_length=50)
    source: Optional[str] = "manual"


class QuestionCreate(QuestionBase):
    """Question create schema"""
    chunk_id: Optional[UUID] = None


class QuestionUpdate(BaseModel):
    """Question update schema"""
    content: Optional[str] = Field(None, min_length=1)
    answer: Optional[str] = None
    question_type: Optional[str] = Field(None, max_length=50)


class QuestionResponse(QuestionBase):
    """Question response schema"""
    model_config = ConfigDict(from_attributes=True)

    id: UUID
    project_id: UUID
    chunk_id: Optional[UUID]
    created_at: datetime
    updated_at: datetime


# Alias for CRUD
QuestionCreateSchema = QuestionCreate
QuestionUpdateSchema = QuestionUpdate
