package register

import (
	"gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
	combatextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/combatturns"
	enemyeventextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/enemyevents"
	itemoccurrenceextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/itemoccurrences"
	itemregistryextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/itemregistry"
	locationoccurrenceextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/locationoccurrences"
	locationextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/locationregistry"
	occurrenceextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/npcoccurrences"
	npcextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/npcregistry"
	scenedescriptionextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/scenedescriptions"
	spellextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/spells"
	combatnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/combatturns"
	enemyeventnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/enemyevents"
	itemoccurrencenormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/itemoccurrences"
	itemregistrynormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/itemregistry"
	locationoccurrencenormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/locationoccurrences"
	locationnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/locationregistry"
	occurrencenormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/npcoccurrences"
	npcnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/npcregistry"
	scenedescriptionnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/scenedescriptions"
	spellnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/spells"
	combatinvariants "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/combatturns/invariants"
	combatshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/combatturns/shape"
	combatsourcerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/combatturns/source_refs"
	combatrelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/combatturns/source_relatedness"
	enemyeventengagements "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/enemyevents/engagements"
	enemyeventinvariants "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/enemyevents/invariants"
	enemyeventshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/enemyevents/shape"
	enemyeventrefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/enemyevents/source_refs"
	enemyeventrelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/enemyevents/source_relatedness"
	itemoccurrenceinvariants "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemoccurrences/invariants"
	itemoccurrenceregistry "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemoccurrences/registry"
	itemoccurrenceshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemoccurrences/shape"
	itemoccurrencerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemoccurrences/source_refs"
	itemoccurrencerelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemoccurrences/source_relatedness"
	itemidentity "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemregistry/identity"
	itemshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemregistry/shape"
	itemrefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemregistry/source_refs"
	itemrelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/itemregistry/source_relatedness"
	locationoccurrenceinvariants "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationoccurrences/invariants"
	locationoccurrenceregistry "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationoccurrences/registry"
	locationoccurrenceshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationoccurrences/shape"
	locationoccurrencerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationoccurrences/source_refs"
	locationoccurrencerelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationoccurrences/source_relatedness"
	locationidentity "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationregistry/identity"
	locationshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationregistry/shape"
	locationrefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationregistry/source_refs"
	locationrelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/locationregistry/source_relatedness"
	npcoccurrenceinvariants "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcoccurrences/invariants"
	npcoccurrenceregistry "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcoccurrences/registry"
	npcoccurrenceshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcoccurrences/shape"
	npcoccurrencerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcoccurrences/source_refs"
	npcoccurrencerelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcoccurrences/source_relatedness"
	npcidentity "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcregistry/identity"
	npcshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcregistry/shape"
	npcsourcerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcregistry/source_refs"
	npcrelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/npcregistry/source_relatedness"
	sceneinvariants "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/scenedescriptions/invariants"
	sceneshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/scenedescriptions/shape"
	scenerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/scenedescriptions/source_refs"
	scenerelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/scenedescriptions/source_relatedness"
	spellcatalog "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/spells/catalog"
	spellshape "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/spells/shape"
	spellsourcerefs "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/spells/source_refs"
	spellrelatedness "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/validate/spells/source_relatedness"
	validjson "gitea.maximumdirect.net/eric/notarius/internal/modules/generic/validate/valid_json"
	validjsonschema "gitea.maximumdirect.net/eric/notarius/internal/modules/generic/validate/valid_json_schema"
)

func registerDefaultChains(registry *pipeline.ValidatorChainRegistry) error {
	return runRegistrations([]registration{
		{name: "spells validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: spellextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(spellshape.Key),
					pipeline.Binding(spellcatalog.Key),
					pipeline.Binding(spellsourcerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(spellrelatedness.Key),
				},
			})
		}},
		{name: "spells normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: spellnormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(spellshape.Key),
					pipeline.Binding(spellcatalog.Key),
					pipeline.Binding(spellsourcerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(spellrelatedness.Key),
				},
			})
		}},
		{name: "npc registry validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: npcextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(npcshape.Key),
					pipeline.Binding(npcsourcerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(npcrelatedness.Key),
				},
			})
		}},
		{name: "npc registry normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: npcnormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(npcshape.Key),
					pipeline.Binding(npcidentity.Key),
					pipeline.Binding(npcsourcerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(npcrelatedness.Key),
				},
			})
		}},
		{name: "combat turns validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: combatextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(combatshape.Key),
					pipeline.Binding(combatsourcerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(combatrelatedness.Key),
				},
			})
		}},
		{name: "combat turns normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: combatnormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(combatshape.Key),
					pipeline.Binding(combatinvariants.Key),
					pipeline.Binding(combatsourcerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(combatrelatedness.Key),
				},
			})
		}},
		{name: "enemy events validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: enemyeventextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(enemyeventshape.Key),
					pipeline.Binding(enemyeventengagements.Key),
					pipeline.Binding(enemyeventrefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(enemyeventrelatedness.Key),
				},
			})
		}},
		{name: "enemy events normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: enemyeventnormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(enemyeventshape.Key),
					pipeline.Binding(enemyeventinvariants.Key),
					pipeline.Binding(enemyeventrefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(enemyeventrelatedness.Key),
				},
			})
		}},
		{name: "item occurrences validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: itemoccurrenceextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(itemoccurrenceshape.Key),
					pipeline.Binding(itemoccurrenceregistry.Key),
					pipeline.Binding(itemoccurrencerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(itemoccurrencerelatedness.Key),
				},
			})
		}},
		{name: "item occurrences normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: itemoccurrencenormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(itemoccurrenceshape.Key),
					pipeline.Binding(itemoccurrenceregistry.Key),
					pipeline.Binding(itemoccurrenceinvariants.Key),
					pipeline.Binding(itemoccurrencerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(itemoccurrencerelatedness.Key),
				},
			})
		}},
		{name: "item registry validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage: pipeline.StageExtract, Module: itemregistryextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key), pipeline.Binding(itemshape.Key), pipeline.Binding(itemrefs.Key),
					pipeline.Binding(validjsonschema.Key), pipeline.Binding(itemrelatedness.Key),
				},
			})
		}},
		{name: "item registry normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage: pipeline.StageNormalize, Module: itemregistrynormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key), pipeline.Binding(itemshape.Key), pipeline.Binding(itemidentity.Key),
					pipeline.Binding(itemrefs.Key), pipeline.Binding(validjsonschema.Key), pipeline.Binding(itemrelatedness.Key),
				},
			})
		}},
		{name: "npc occurrences validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: occurrenceextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(npcoccurrenceshape.Key),
					pipeline.Binding(npcoccurrenceregistry.Key),
					pipeline.Binding(npcoccurrencerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(npcoccurrencerelatedness.Key),
				},
			})
		}},
		{name: "npc occurrences normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: occurrencenormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(npcoccurrenceshape.Key),
					pipeline.Binding(npcoccurrenceregistry.Key),
					pipeline.Binding(npcoccurrenceinvariants.Key),
					pipeline.Binding(npcoccurrencerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(npcoccurrencerelatedness.Key),
				},
			})
		}},
		{name: "scene descriptions validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageExtract,
				Module: scenedescriptionextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(sceneshape.Key),
					pipeline.Binding(scenerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(scenerelatedness.Key),
				},
			})
		}},
		{name: "scene descriptions normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage:  pipeline.StageNormalize,
				Module: scenedescriptionnormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key),
					pipeline.Binding(sceneshape.Key),
					pipeline.Binding(sceneinvariants.Key),
					pipeline.Binding(scenerefs.Key),
					pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(scenerelatedness.Key),
				},
			})
		}},
		{name: "location registry validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage: pipeline.StageExtract, Module: locationextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key), pipeline.Binding(locationshape.Key), pipeline.Binding(locationrefs.Key),
					pipeline.Binding(validjsonschema.Key), pipeline.Binding(locationrelatedness.Key),
				},
			})
		}},
		{name: "location registry normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage: pipeline.StageNormalize, Module: locationnormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key), pipeline.Binding(locationshape.Key), pipeline.Binding(locationidentity.Key),
					pipeline.Binding(locationrefs.Key), pipeline.Binding(validjsonschema.Key), pipeline.Binding(locationrelatedness.Key),
				},
			})
		}},
		{name: "location occurrences validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage: pipeline.StageExtract, Module: locationoccurrenceextract.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key), pipeline.Binding(locationoccurrenceshape.Key), pipeline.Binding(locationoccurrenceregistry.Key),
					pipeline.Binding(locationoccurrencerefs.Key), pipeline.Binding(validjsonschema.Key), pipeline.Binding(locationoccurrencerelatedness.Key),
				},
			})
		}},
		{name: "location occurrences normalize validator chain", register: func() error {
			return registry.Register(pipeline.ValidatorChainMapping{
				Stage: pipeline.StageNormalize, Module: locationoccurrencenormalize.Key,
				Validators: []pipeline.ModuleBinding{
					pipeline.Binding(validjson.Key), pipeline.Binding(locationoccurrenceshape.Key), pipeline.Binding(locationoccurrenceregistry.Key),
					pipeline.Binding(locationoccurrenceinvariants.Key), pipeline.Binding(locationoccurrencerefs.Key), pipeline.Binding(validjsonschema.Key),
					pipeline.Binding(locationoccurrencerelatedness.Key),
				},
			})
		}},
	})
}
