from pydantic import BaseModel, Field

from app.schemas.indexing import ChangedFile, FileSnapshot, IndexJobStatus


class RagSessionCreateRequest(BaseModel):
    project_id: str = Field(min_length=1)
    files: list[FileSnapshot]


class RagSessionCreateResponse(BaseModel):
    rag_session_id: str
    index_job_id: str
    status: IndexJobStatus


class RagSessionChangesRequest(BaseModel):
    changed_files: list[ChangedFile]


class RagSessionJobResponse(BaseModel):
    rag_session_id: str
    index_job_id: str
    status: IndexJobStatus
    indexed_files: int = 0
    failed_files: int = 0
    cache_hit_files: int = 0
    cache_miss_files: int = 0
    error: dict | None = None
