package models

import (
	"time"

	"github.com/google/uuid"
)

type MMRHistory struct {
	ID        uuid.UUID  `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
	UserID    uuid.UUID  `gorm:"type:uuid;not null;index" json:"user_id"`
	MatchID   *uuid.UUID `gorm:"type:uuid" json:"match_id,omitempty"`
	OldMMR    int        `gorm:"not null" json:"old_mmr"`
	NewMMR    int        `gorm:"not null" json:"new_mmr"`
	Delta     int        `gorm:"not null" json:"delta"`
	Reason    string     `gorm:"type:varchar(32);not null" json:"reason"`
	MetaJSON  *string    `gorm:"type:text;column:metadata" json:"metadata,omitempty"`
	CreatedAt time.Time  `gorm:"not null" json:"created_at"`
}

const (
	MMRReasonMatch         = "match"
	MMRReasonDecay         = "decay"
	MMRReasonAdminOverride = "admin_override"
	MMRReasonPlacement     = "placement"
)
