"""Pipeline models for VoIdea - voice processing pipeline stages.""" from datetime import datetime from typing import Optional from sqlalchemy import Boolean, Float, ForeignKey, Integer, String from sqlalchemy.dialects.postgresql import JSONB, UUID from sqlalchemy.orm import Mapped, mapped_column from app.core.base import SQLBase, TimestampMixin, UUIDMixin class PipelineStats(SQLBase, TimestampMixin): __tablename__ = "pipeline_stats" id: Mapped[str] = mapped_column( String(36), primary_key=True, default=lambda: str(__import__("uuid").uuid4()) ) user_id: Mapped[Optional[str]] = mapped_column( String(36), ForeignKey("users.id", ondelete="CASCADE"), nullable=True, index=True ) stage: Mapped[str] = mapped_column( String(50), nullable=False, index=True ) passed: Mapped[bool] = mapped_column( Boolean, nullable=False ) reason: Mapped[Optional[str]] = mapped_column( String(255), nullable=True ) duration_ms: Mapped[Optional[int]] = mapped_column( Integer, nullable=True ) created_at: Mapped[datetime] = mapped_column( nullable=False, default=lambda: datetime.now(__import__("datetime").timezone.utc), )