// Package dnd owns the canonical in-process artifact types for the D&D domain.
package dnd

import (
	"gitea.maximumdirect.net/eric/notarius/internal/core/source"
	"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
)

const SpellListKind contracts.ArtifactKind = "dnd/spell-list"

const NPCRegistryKind contracts.ArtifactKind = "dnd/npc-registry"

const CombatTurnListKind contracts.ArtifactKind = "dnd/combat-turn-list"

const NPCOccurrenceListKind contracts.ArtifactKind = "dnd/npc-occurrence-list"

const SceneDescriptionListKind contracts.ArtifactKind = "dnd/scene-description-list"

const ItemOccurrenceListKind contracts.ArtifactKind = "dnd/item-occurrence-list"

const ItemRegistryKind contracts.ArtifactKind = "dnd/item-registry"

const EnemyEventListKind contracts.ArtifactKind = "dnd/enemy-event-list"

const LocationRegistryKind contracts.ArtifactKind = "dnd/location-registry"

const LocationOccurrenceListKind contracts.ArtifactKind = "dnd/location-occurrence-list"

type SpellList struct {
	SpellCasts []SpellCast `json:"spell_casts"`
}

type SpellCast struct {
	Caster     string             `json:"caster"`
	Spell      string             `json:"spell"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type NPCRegistry struct {
	NPCs []NPC `json:"npcs"`
}

type NPC struct {
	ID         string             `json:"id"`
	Name       string             `json:"name"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type CombatTurnList struct {
	CombatTurns []CombatTurn `json:"combat_turns"`
}

type CombatTurnKind string

const (
	CombatTurnKindTurn            CombatTurnKind = "turn"
	CombatTurnKindReaction        CombatTurnKind = "reaction"
	CombatTurnKindLegendaryAction CombatTurnKind = "legendary_action"
	CombatTurnKindLairAction      CombatTurnKind = "lair_action"
	CombatTurnKindOther           CombatTurnKind = "other"
)

type CombatTurn struct {
	Actor      string             `json:"actor"`
	TurnKind   CombatTurnKind     `json:"turn_kind"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type NPCOccurrenceKind string

const (
	NPCOccurrenceKindMentioned         NPCOccurrenceKind = "mentioned"
	NPCOccurrenceKindNoncombatPresence NPCOccurrenceKind = "noncombat_presence"
	NPCOccurrenceKindDialogue          NPCOccurrenceKind = "dialogue"
	NPCOccurrenceKindCombatAlly        NPCOccurrenceKind = "combat_ally"
	NPCOccurrenceKindCombatOpponent    NPCOccurrenceKind = "combat_opponent"
	NPCOccurrenceKindOther             NPCOccurrenceKind = "other"
)

type NPCOccurrenceList struct {
	Occurrences []NPCOccurrence `json:"occurrences"`
}

type NPCOccurrence struct {
	NPCID      string             `json:"npc_id"`
	Name       string             `json:"name"`
	Kind       NPCOccurrenceKind  `json:"kind"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type SceneKind string

const (
	SceneKindCombat    SceneKind = "combat"
	SceneKindNarrative SceneKind = "narrative"
	SceneKindRecap     SceneKind = "recap"
	SceneKindMeta      SceneKind = "meta"
)

type SceneDescriptionList struct {
	Scenes []SceneDescription `json:"scenes"`
}

type SceneDescription struct {
	ID        string           `json:"id"`
	SourceRef source.SourceRef `json:"source_ref"`
	Kind      SceneKind        `json:"kind"`
	Title     string           `json:"title"`
	Summary   string           `json:"summary"`
}

type ItemOccurrenceKind string

const (
	ItemOccurrenceKindDiscovered  ItemOccurrenceKind = "discovered"
	ItemOccurrenceKindAcquired    ItemOccurrenceKind = "acquired"
	ItemOccurrenceKindLost        ItemOccurrenceKind = "lost"
	ItemOccurrenceKindConsumed    ItemOccurrenceKind = "consumed"
	ItemOccurrenceKindTransferred ItemOccurrenceKind = "transferred"
)

type ItemOccurrenceList struct {
	Occurrences []ItemOccurrence `json:"occurrences"`
}

type ItemOccurrence struct {
	ItemID     string             `json:"item_id"`
	Name       string             `json:"name"`
	Kind       ItemOccurrenceKind `json:"kind"`
	Quantity   *int               `json:"quantity,omitempty"`
	From       string             `json:"from,omitempty"`
	To         string             `json:"to,omitempty"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type ItemRegistry struct {
	Items []Item `json:"items"`
}

type Item struct {
	ID         string             `json:"id"`
	Name       string             `json:"name"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type EnemyEventKind string

const (
	EnemyEventKindEngaged       EnemyEventKind = "engaged"
	EnemyEventKindKilled        EnemyEventKind = "killed"
	EnemyEventKindFled          EnemyEventKind = "fled"
	EnemyEventKindCaptured      EnemyEventKind = "captured"
	EnemyEventKindIncapacitated EnemyEventKind = "incapacitated"
)

type EnemyEventList struct {
	Events []EnemyEvent `json:"events"`
}

type EnemyEvent struct {
	Name       string             `json:"name"`
	Kind       EnemyEventKind     `json:"kind"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type LocationRegistry struct {
	Locations []Location `json:"locations"`
}

type Location struct {
	ID         string             `json:"id"`
	Name       string             `json:"name"`
	SourceRefs []source.SourceRef `json:"source_refs"`
}

type LocationOccurrenceKind string

const (
	LocationOccurrenceKindVisited   LocationOccurrenceKind = "visited"
	LocationOccurrenceKindPlanned   LocationOccurrenceKind = "planned"
	LocationOccurrenceKindRecalled  LocationOccurrenceKind = "recalled"
	LocationOccurrenceKindMentioned LocationOccurrenceKind = "mentioned"
)

type LocationOccurrenceList struct {
	Occurrences []LocationOccurrence `json:"occurrences"`
}

type LocationOccurrence struct {
	LocationID string                 `json:"location_id"`
	Name       string                 `json:"name"`
	Kind       LocationOccurrenceKind `json:"kind"`
	SourceRefs []source.SourceRef     `json:"source_refs"`
}
