package models

import "time"

// LiquidationRecord stores each batch liquidation execution
type LiquidationRecord struct {
	ID             uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	ChainID        int       `gorm:"index" json:"chain_id"`
	TxHash         string    `gorm:"size:66;uniqueIndex" json:"tx_hash"`
	LiquidatorAddr string    `gorm:"size:42" json:"liquidator_addr"`
	AccountCount   int       `json:"account_count"`
	Accounts       string    `gorm:"type:text" json:"accounts"` // JSON array of addresses
	GasUsed        uint64    `json:"gas_used"`
	BlockNumber    uint64    `json:"block_number"`
	Status         string    `gorm:"size:20;default:'success'" json:"status"` // success / failed
	ErrorMessage   string    `gorm:"type:text" json:"error_message,omitempty"`
	CreatedAt      time.Time `json:"created_at"`
}

func (LiquidationRecord) TableName() string {
	return "liquidation_records"
}
