package enum

import "fmt"

type InfrastructureType int

const (
	DOCKER InfrastructureType = iota
	KUBERNETES
	SLURM
	HW
	CONDOR
)

func (t InfrastructureType) String() string {
	return [...]string{"DOCKER", "KUBERNETES", "SLURM", "HW", "CONDOR"}[t]
}

// get list of all infrastructure types
func InfrastructureList() []InfrastructureType {
	return []InfrastructureType{DOCKER, KUBERNETES, SLURM, HW, CONDOR}
}

func (d InfrastructureType) Compare(indexStr interface{}) bool {
	return fmt.Sprintf("%v", indexStr) == fmt.Sprintf("%v", d.EnumIndex()) || fmt.Sprintf("%v", indexStr) == d.String()
}

func (d InfrastructureType) EnumIndex() int {
	return int(d)
}
