package models

import (
	"time"

	"gorm.io/gorm"
)

// MatchOverride stores admin overrides for externally-fetched matches (FACR)
// It uses ExternalMatchID (e.g., FACR match_id) as stable key and allows overriding
// names, venue, datetime and logos.
type MatchOverride struct {
	gorm.Model
	ExternalMatchID   string     `gorm:"uniqueIndex;not null" json:"external_match_id"`
	HomeNameOverride  *string    `json:"home_name_override"`
	AwayNameOverride  *string    `json:"away_name_override"`
	VenueOverride     *string    `json:"venue_override"`
	DateTimeOverride  *time.Time `json:"date_time_override"`
	HomeLogoURL       *string    `json:"home_logo_url"`
	AwayLogoURL       *string    `json:"away_logo_url"`
	Notes             string     `gorm:"type:text" json:"notes"`
}

func (MatchOverride) TableName() string { return "match_overrides" }

// TeamLogoOverride persists custom team logos to override remote ones
// Keyed by ExternalTeamID (e.g., FACR team id)
type TeamLogoOverride struct {
	gorm.Model
	ExternalTeamID string `gorm:"uniqueIndex;not null" json:"external_team_id"`
	TeamName       string `json:"team_name"`
	LogoURL        string `json:"logo_url"`
}

func (TeamLogoOverride) TableName() string { return "team_logo_overrides" }
