"""
Evaluation Dataset Schemas
"""
from datetime import datetime
from typing import Optional, Any
from uuid import UUID
from pydantic import BaseModel, ConfigDict, Field


class EvalDatasetBase(BaseModel):
    """Base eval dataset schema"""
    name: str = Field(..., min_length=1, max_length=255)
    question_type: Optional[str] = Field("mixed", max_length=50)
    extra_data: Optional[dict] = None


class EvalDatasetCreate(EvalDatasetBase):
    """Eval dataset create schema"""
    pass


class EvalDatasetUpdate(BaseModel):
    """Eval dataset update schema"""
    name: Optional[str] = Field(None, min_length=1, max_length=255)
    question_type: Optional[str] = Field(None, max_length=50)
    extra_data: Optional[dict] = None


class EvalDatasetResponse(EvalDatasetBase):
    """Eval dataset response schema"""
    model_config = ConfigDict(from_attributes=True)

    id: UUID
    project_id: UUID
    created_at: datetime
    updated_at: datetime


class TaskBase(BaseModel):
    """Base task schema"""
    task_type: str = Field(..., max_length=50)
    status: Optional[str] = "pending"
    progress: Optional[int] = Field(0, ge=0, le=100)
    result: Optional[Any] = None
    error: Optional[str] = None


class TaskResponse(TaskBase):
    """Task response schema"""
    model_config = ConfigDict(from_attributes=True)

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


# Alias for CRUD
EvalDatasetCreateSchema = EvalDatasetCreate
EvalDatasetUpdateSchema = EvalDatasetUpdate
