"""Voice command model — user-specific dynamic commands for self-learning.""" from typing import Optional from sqlalchemy import Boolean, ForeignKey, Integer, String from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import Mapped, mapped_column from app.core.base import SQLBase, TimestampMixin, UUIDMixin class VoiceCommand(SQLBase, UUIDMixin, TimestampMixin): __tablename__ = "voice_commands" user_id: Mapped[UUID] = mapped_column( UUID(as_uuid=True), ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True, ) phrase: Mapped[str] = mapped_column( String(255), nullable=False ) action: Mapped[str] = mapped_column( String(50), nullable=False ) agent_name: Mapped[Optional[str]] = mapped_column( String(100), nullable=True ) count: Mapped[int] = mapped_column( Integer, default=0, nullable=False ) is_active: Mapped[bool] = mapped_column( Boolean, default=True, nullable=False )