package common

import (
	"strings"
)

type UpdateManifestType int

const (
	SoftwareUpdateType      UpdateManifestType = 1
	ConfigUpdateType        UpdateManifestType = 2
	MagnaManifestUpdateType UpdateManifestType = 3
	AftersalesUpdateType    UpdateManifestType = 4
	AsBuiltUpdateType       UpdateManifestType = 5 // These manifests are only for cars coming out of the factory
)

func StringToUpdateManifestType(manifestType string)(updateManifestType UpdateManifestType){
	manifestType = strings.ToLower(manifestType)
	switch manifestType{
	case "", "fisker":
		return SoftwareUpdateType
	case "magna":
		return MagnaManifestUpdateType
	case "aftersales":
		return AftersalesUpdateType
	default:
		// Find out why this is a import loop
		// logger.Warn().Msgf("recieved an unknown manifest type, default to fisker software update: %s", manifestType)
		return SoftwareUpdateType
	}
}
