package horse

type SupportCardID int32

type SupportCard struct {
	ID           SupportCardID           `json:"id"`
	Name         string                  `json:"name"`
	CharacterID  CharacterID             `json:"chara_id"`
	CharaName    string                  `json:"chara_name"`
	Rarity       SupportCardRarity       `json:"rarity"`
	Specialty    SupportCardSpecialty    `json:"specialty"`
	Type         SupportCardType         `json:"type"`
	Effects      [11][]SupportCardEffect `json:"effects"`
	UniqueEffect *UniqueEffect           `json:"unique_effect,omitzero"`
	Hints        []Hint                  `json:"hints"`
	Outings      int32                   `json:"outings,omitzero"`
}

type SupportCardRarity int8

//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SupportCardRarity
const (
	R   SupportCardRarity = 1
	SR  SupportCardRarity = 2
	SSR SupportCardRarity = 3
)

type SupportCardSpecialty int8

//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SupportCardSpecialty -trimprefix SupportCard
const (
	SupportCardNone    SupportCardSpecialty = 0
	SupportCardSpeed   SupportCardSpecialty = 101
	SupportCardPower   SupportCardSpecialty = 102
	SupportCardGuts    SupportCardSpecialty = 103
	SupportCardStamina SupportCardSpecialty = 105
	SupportCardWit     SupportCardSpecialty = 106
)

type SupportCardType int8

const (
	SupportCardNormal SupportCardType = 1
	SupportCardPal    SupportCardType = 2
	SupportCardGroup  SupportCardType = 3
)

type SupportCardEffectType int8

//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SupportCardEffectType -linecomment
const (
	SupportCardFriendshipBonus       SupportCardEffectType = 1  // Friendship Bonus
	SupportCardMoodEffect            SupportCardEffectType = 2  // Mood Effect
	SupportCardSpeedBonus            SupportCardEffectType = 3  // Speed Bonus
	SupportCardStaminaBonus          SupportCardEffectType = 4  // Stamina Bonus
	SupportCardPowerBonus            SupportCardEffectType = 5  // Power Bonus
	SupportCardGutsBonus             SupportCardEffectType = 6  // Guts Bonus
	SupportCardWitBonus              SupportCardEffectType = 7  // Wit Bonus
	SupportCardTrainingEffectiveness SupportCardEffectType = 8  // Training Effectiveness
	SupportCardInitialSpeed          SupportCardEffectType = 9  // Initial Speed
	SupportCardInitialStamina        SupportCardEffectType = 10 // Initial Stamina
	SupportCardInitialPower          SupportCardEffectType = 11 // Initial Power
	SupportCardInitialGuts           SupportCardEffectType = 12 // Initial Guts
	SupportCardInitialWit            SupportCardEffectType = 13 // Initial Wit
	SupportCardInitialFriendship     SupportCardEffectType = 14 // Initial Friendship Gauge
	SupportCardRaceBonus             SupportCardEffectType = 15 // Race Bonus
	SupportCardFanBonus              SupportCardEffectType = 16 // Fan Bonus
	SupportCardHintLevels            SupportCardEffectType = 17 // Hint Levels
	SupportCardHintFrequency         SupportCardEffectType = 18 // Hint Frequency
	SupportCardSpecialtyPriority     SupportCardEffectType = 19 // Specialty Priority
	SupportCardMaxSpeed              SupportCardEffectType = 20 // Max Speed
	SupportCardMaxStamina            SupportCardEffectType = 21 // Max Stamina
	SupportCardMaxPower              SupportCardEffectType = 22 // Max Power
	SupportCardMaxGuts               SupportCardEffectType = 23 // Max Guts
	SupportCardMaxWit                SupportCardEffectType = 24 // Max Wit
	SupportCardEventRecovery         SupportCardEffectType = 25 // Event Recovery
	SupportCardEventEffectiveness    SupportCardEffectType = 26 // Event Effectiveness
	SupportCardFailureProtection     SupportCardEffectType = 27 // Failure Protection
	SupportCardEnergyCostReduction   SupportCardEffectType = 28 // Energy Cost Reduction
	SupportCardMinigameEffectiveness SupportCardEffectType = 29 // Minigame Effectiveness
	SupportCardSkillPointBonus       SupportCardEffectType = 30 // Skill Point Bonus
	SupportCardWitFriendshipRecovery SupportCardEffectType = 31 // Wit Friendship Recovery

	// Unique effect types
	SupportCardUniqueFriendshipThreshold                 SupportCardEffectType = 101 // Friendship Gauge threshold
	SupportCardUniqueOffSpecialty                        SupportCardEffectType = 102 // Friendship Gauge threshold and off specialty
	SupportCardUniqueColorThresholdTrainingEffectiveness SupportCardEffectType = 103 // Training Effectiveness with multicolor deck
	SupportCardUniqueFanScalingTrainingEffectiveness     SupportCardEffectType = 104 // Training Effectiveness scaling with fans
	SupportCardUniqueColorInitialStats                   SupportCardEffectType = 105 // Initial Stats for each card
	SupportCardUniqueRainbowStack                        SupportCardEffectType = 106 // stacking bonus per Friendship Training
	SupportCardUniqueLowEnergyScaling                    SupportCardEffectType = 107 // scaling as Energy decreases
	SupportCardUniqueMaxEnergyScaling                    SupportCardEffectType = 108 // scaling with Max Energy
	SupportCardUniqueTotalFriendship                     SupportCardEffectType = 109 // scaling with total Friendship
	SupportCardUniqueCardCount                           SupportCardEffectType = 110 // scaling with the number of supports at the training
	SupportCardUniqueFacilityLevel                       SupportCardEffectType = 111 // scaling with the training facility level
	SupportCardUniqueDisableFailure                      SupportCardEffectType = 112 // chance to disable failure chance
	SupportCardUniqueFriendshipTrainingAdditionalEffect  SupportCardEffectType = 113 // additional effect active on Friendship Training
)

type SupportCardEffect struct {
	Type  SupportCardEffectType `json:"type"`
	Value int32                 `json:"value"`
}

type UniqueEffect struct {
	Name        string                `json:"name"`
	Desc        string                `json:"description"`
	CardLevel   int32                 `json:"card_level"`
	Type        SupportCardEffectType `json:"type"`
	Args        []int32               `json:"args"`
	Type2       SupportCardEffectType `json:"type2,omitzero"`
	Args2       []int32               `json:"args2,omitempty"`
	IdleSubRate int32                 `json:"idle_mode_sub_rate"`
}

type Hint struct {
	SkillID SkillID `json:"skill_id,omitzero"`
	Speed   int8    `json:"speed,omitzero"`
	Stamina int8    `json:"stamina,omitzero"`
	Power   int8    `json:"power,omitzero"`
	Guts    int8    `json:"guts,omitzero"`
	Wit     int8    `json:"wit,omitzero"`
	SP      int8    `json:"sp,omitzero"`
}
