"""GPU Cluster model for L1 data"""

from sqlalchemy import Column, DateTime, Float, Integer, String, Text
from sqlalchemy.sql import func

from app.db.session import Base


class GPUCluster(Base):
    __tablename__ = "gpu_clusters"

    id = Column(Integer, primary_key=True, autoincrement=True)
    time = Column(DateTime(timezone=True), nullable=False)
    cluster_id = Column(String(100), nullable=False, index=True)
    name = Column(String(200), nullable=False)
    country = Column(String(100))
    city = Column(String(100))
    latitude = Column(Float)
    longitude = Column(Float)
    organization = Column(String(200))
    gpu_count = Column(Integer)
    gpu_type = Column(String(100))
    total_flops = Column(Float)
    rank = Column(Integer)
    source = Column(String(50), nullable=False)
    created_at = Column(DateTime(timezone=True), server_default=func.now())

    def __repr__(self):
        return f"<GPUCluster {self.cluster_id}: {self.name}>"
