// Code generated by "enumer -type=DNSPolicy -trimprefix DNS -output dns_policy_gen.go"; DO NOT EDIT.

//
package types

import (
	"fmt"
)

const _DNSPolicyName = "preferIPv4preferIPv6onlyIPv4onlyIPv6any"

var _DNSPolicyIndex = [...]uint8{0, 10, 20, 28, 36, 39}

func (i DNSPolicy) String() string {
	i -= 1
	if i >= DNSPolicy(len(_DNSPolicyIndex)-1) {
		return fmt.Sprintf("DNSPolicy(%d)", i+1)
	}
	return _DNSPolicyName[_DNSPolicyIndex[i]:_DNSPolicyIndex[i+1]]
}

var _DNSPolicyValues = []DNSPolicy{1, 2, 3, 4, 5}

var _DNSPolicyNameToValueMap = map[string]DNSPolicy{
	_DNSPolicyName[0:10]:  1,
	_DNSPolicyName[10:20]: 2,
	_DNSPolicyName[20:28]: 3,
	_DNSPolicyName[28:36]: 4,
	_DNSPolicyName[36:39]: 5,
}

// DNSPolicyString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func DNSPolicyString(s string) (DNSPolicy, error) {
	if val, ok := _DNSPolicyNameToValueMap[s]; ok {
		return val, nil
	}
	return 0, fmt.Errorf("%s does not belong to DNSPolicy values", s)
}

// DNSPolicyValues returns all values of the enum
func DNSPolicyValues() []DNSPolicy {
	return _DNSPolicyValues
}

// IsADNSPolicy returns "true" if the value is listed in the enum definition. "false" otherwise
func (i DNSPolicy) IsADNSPolicy() bool {
	for _, v := range _DNSPolicyValues {
		if i == v {
			return true
		}
	}
	return false
}
