package ecs

// config provides configuration for an ECS [World].
type config struct {
	// Initial capacity for archetypes and the entity index.
	// The default value is 128.
	initialCapacity int
	// Initial capacity for archetypes with a relation component.
	// The default value is initialCapacity.
	initialCapacityRelations int
}

// newConfig creates a new default [World] configuration.
func newConfig( ...int) config {
	switch len() {
	case 0:
		return config{
			initialCapacity:          1024,
			initialCapacityRelations: 128,
		}
	case 1:
		if [0] < 1 {
			panic("only positive values for the World's initialCapacity are allowed")
		}
		return config{
			initialCapacity:          [0],
			initialCapacityRelations: [0],
		}
	case 2:
		if [0] < 1 || [1] < 1 {
			panic("only positive values for the World's initialCapacity are allowed")
		}
		return config{
			initialCapacity:          [0],
			initialCapacityRelations: [1],
		}
	}
	panic("can only use a maximum of two values for the World's initialCapacity")
}