package models

import "time"

// SystemContract is the central registry for all infrastructure contract addresses.
// One row per (name, chain_id) pair.
// Replaces the former alp_pools and lending_markets tables (which had only one row each).
type SystemContract struct {
	ID          uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Name        string    `gorm:"size:100;not null;uniqueIndex:uk_name_chain" json:"name"`
	ChainID     int       `gorm:"not null;uniqueIndex:uk_name_chain" json:"chain_id"`
	Address     string    `gorm:"size:42" json:"address"`
	DeployBlock *uint64   `json:"deploy_block"`
	Description string    `gorm:"type:text" json:"description"`
	IsActive    bool      `gorm:"default:true" json:"is_active"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

func (SystemContract) TableName() string { return "system_contracts" }
