package horse

type (
	SparkID      int32
	SparkGroupID int32
)

type Spark struct {
	ID          SparkID         `json:"spark_id"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Group       SparkGroupID    `json:"spark_group"`
	Rarity      SparkRarity     `json:"rarity"`
	Type        SparkType       `json:"type"`
	Effects     [][]SparkEffect `json:"effects"`
}

type SparkType int8

//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SparkType -trimprefix Spark
const (
	SparkStat SparkType = iota + 1
	SparkAptitude
	SparkUnique
	SparkSkill
	SparkRace
	SparkScenario
	SparkCarnival
	SparkDistance
	SparkHidden
	SparkSurface
	SparkStyle
)

type SparkRarity int8

const (
	OneStar   SparkRarity = iota + 1 // ★
	TwoStar                          // ★★
	ThreeStar                        // ★★★
)

func (r SparkRarity) String() string {
	const s = "★★★"
	return s[:int(r)*len("★")]
}

type SparkEffect struct {
	Target SparkTarget `json:"target"`
	Value1 int32       `json:"value1,omitzero"`
	Value2 int32       `json:"value2,omitzero"`
}

type SparkTarget int8

//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SparkTarget -trimprefix Spark
const (
	SparkSpeed SparkTarget = iota + 1
	SparkStam
	SparkPower
	SparkGuts
	SparkWit
	SparkSkillPoints
	SparkRandomStat

	SparkTurf SparkTarget = 11
	SparkDirt SparkTarget = 12

	SparkFrontRunner SparkTarget = iota + 12
	SparkPaceChaser
	SparkLateSurger
	SparkEndCloser

	SparkSprint SparkTarget = iota + 18
	SparkMile
	SparkMedium
	SparkLong

	SparkSkillHint     SparkTarget = 41
	SparkCarnivalBonus SparkTarget = 51

	SparkSpeedCap SparkTarget = iota + 42
	SparkStamCap
	SparkPowerCap
	SparkGutsCap
	SparkWitCap
)
