"""Admin model for Sneaky Klaus. The Admin model represents the single administrator account for the entire installation. """ from datetime import datetime from sqlalchemy import DateTime, String from sqlalchemy.orm import Mapped, mapped_column from src.app import db class Admin(db.Model): # type: ignore[name-defined] """Administrator user model. Represents the single admin account for the entire Sneaky Klaus installation. Only one admin should exist per deployment. Attributes: id: Auto-increment primary key. email: Admin email address (unique, indexed). password_hash: bcrypt password hash. created_at: Account creation timestamp. updated_at: Last update timestamp. """ __tablename__ = "admin" id: Mapped[int] = mapped_column(primary_key=True) email: Mapped[str] = mapped_column( String(255), unique=True, nullable=False, index=True ) password_hash: Mapped[str] = mapped_column(String(255), nullable=False) created_at: Mapped[datetime] = mapped_column( DateTime, nullable=False, default=datetime.utcnow ) updated_at: Mapped[datetime] = mapped_column( DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow, ) def __repr__(self) -> str: """String representation of Admin instance.""" return f""