from sqlalchemy import Column, DateTime, BigInteger, ForeignKey
from sqlalchemy.sql import func
from app.db.session import Base


class Circuit(Base):
    __tablename__ = "circuits"
    
    id = Column(BigInteger, primary_key=True, autoincrement=True)
    local_flight_id = Column(BigInteger, ForeignKey("local_flights.id", ondelete="CASCADE"), nullable=False, index=True)
    circuit_timestamp = Column(DateTime, nullable=False, index=True)
    created_at = Column(DateTime, nullable=False, server_default=func.current_timestamp())
