// Code generated by "enumer -type ServerCode -trimprefix ServerCode -output server_code_enum.go"; DO NOT EDIT.

package proto

import (
	"fmt"
	"strings"
)

const (
	_ServerCodeName_0      = "HelloDataExceptionProgressPongEndOfStreamProfileTotalsExtremesTablesStatusLogTableColumnsServerPartUUIDsServerReadTaskRequestServerProfileEvents"
	_ServerCodeLowerName_0 = "hellodataexceptionprogresspongendofstreamprofiletotalsextremestablesstatuslogtablecolumnsserverpartuuidsserverreadtaskrequestserverprofileevents"
	_ServerCodeName_1      = "SSHChallenge"
	_ServerCodeLowerName_1 = "sshchallenge"
)

var (
	_ServerCodeIndex_0 = [...]uint8{0, 5, 9, 18, 26, 30, 41, 48, 54, 62, 74, 77, 89, 104, 125, 144}
	_ServerCodeIndex_1 = [...]uint8{0, 12}
)

func (i ServerCode) String() string {
	switch {
	case 0 <= i && i <= 14:
		return _ServerCodeName_0[_ServerCodeIndex_0[i]:_ServerCodeIndex_0[i+1]]
	case i == 18:
		return _ServerCodeName_1
	default:
		return fmt.Sprintf("ServerCode(%d)", i)
	}
}

// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _ServerCodeNoOp() {
	var x [1]struct{}
	_ = x[ServerCodeHello-(0)]
	_ = x[ServerCodeData-(1)]
	_ = x[ServerCodeException-(2)]
	_ = x[ServerCodeProgress-(3)]
	_ = x[ServerCodePong-(4)]
	_ = x[ServerCodeEndOfStream-(5)]
	_ = x[ServerCodeProfile-(6)]
	_ = x[ServerCodeTotals-(7)]
	_ = x[ServerCodeExtremes-(8)]
	_ = x[ServerCodeTablesStatus-(9)]
	_ = x[ServerCodeLog-(10)]
	_ = x[ServerCodeTableColumns-(11)]
	_ = x[ServerPartUUIDs-(12)]
	_ = x[ServerReadTaskRequest-(13)]
	_ = x[ServerProfileEvents-(14)]
	_ = x[ServerCodeSSHChallenge-(18)]
}

var _ServerCodeValues = []ServerCode{ServerCodeHello, ServerCodeData, ServerCodeException, ServerCodeProgress, ServerCodePong, ServerCodeEndOfStream, ServerCodeProfile, ServerCodeTotals, ServerCodeExtremes, ServerCodeTablesStatus, ServerCodeLog, ServerCodeTableColumns, ServerPartUUIDs, ServerReadTaskRequest, ServerProfileEvents, ServerCodeSSHChallenge}

var _ServerCodeNameToValueMap = map[string]ServerCode{
	_ServerCodeName_0[0:5]:          ServerCodeHello,
	_ServerCodeLowerName_0[0:5]:     ServerCodeHello,
	_ServerCodeName_0[5:9]:          ServerCodeData,
	_ServerCodeLowerName_0[5:9]:     ServerCodeData,
	_ServerCodeName_0[9:18]:         ServerCodeException,
	_ServerCodeLowerName_0[9:18]:    ServerCodeException,
	_ServerCodeName_0[18:26]:        ServerCodeProgress,
	_ServerCodeLowerName_0[18:26]:   ServerCodeProgress,
	_ServerCodeName_0[26:30]:        ServerCodePong,
	_ServerCodeLowerName_0[26:30]:   ServerCodePong,
	_ServerCodeName_0[30:41]:        ServerCodeEndOfStream,
	_ServerCodeLowerName_0[30:41]:   ServerCodeEndOfStream,
	_ServerCodeName_0[41:48]:        ServerCodeProfile,
	_ServerCodeLowerName_0[41:48]:   ServerCodeProfile,
	_ServerCodeName_0[48:54]:        ServerCodeTotals,
	_ServerCodeLowerName_0[48:54]:   ServerCodeTotals,
	_ServerCodeName_0[54:62]:        ServerCodeExtremes,
	_ServerCodeLowerName_0[54:62]:   ServerCodeExtremes,
	_ServerCodeName_0[62:74]:        ServerCodeTablesStatus,
	_ServerCodeLowerName_0[62:74]:   ServerCodeTablesStatus,
	_ServerCodeName_0[74:77]:        ServerCodeLog,
	_ServerCodeLowerName_0[74:77]:   ServerCodeLog,
	_ServerCodeName_0[77:89]:        ServerCodeTableColumns,
	_ServerCodeLowerName_0[77:89]:   ServerCodeTableColumns,
	_ServerCodeName_0[89:104]:       ServerPartUUIDs,
	_ServerCodeLowerName_0[89:104]:  ServerPartUUIDs,
	_ServerCodeName_0[104:125]:      ServerReadTaskRequest,
	_ServerCodeLowerName_0[104:125]: ServerReadTaskRequest,
	_ServerCodeName_0[125:144]:      ServerProfileEvents,
	_ServerCodeLowerName_0[125:144]: ServerProfileEvents,
	_ServerCodeName_1[0:12]:         ServerCodeSSHChallenge,
	_ServerCodeLowerName_1[0:12]:    ServerCodeSSHChallenge,
}

var _ServerCodeNames = []string{
	_ServerCodeName_0[0:5],
	_ServerCodeName_0[5:9],
	_ServerCodeName_0[9:18],
	_ServerCodeName_0[18:26],
	_ServerCodeName_0[26:30],
	_ServerCodeName_0[30:41],
	_ServerCodeName_0[41:48],
	_ServerCodeName_0[48:54],
	_ServerCodeName_0[54:62],
	_ServerCodeName_0[62:74],
	_ServerCodeName_0[74:77],
	_ServerCodeName_0[77:89],
	_ServerCodeName_0[89:104],
	_ServerCodeName_0[104:125],
	_ServerCodeName_0[125:144],
	_ServerCodeName_1[0:12],
}

// ServerCodeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ServerCodeString(s string) (ServerCode, error) {
	if val, ok := _ServerCodeNameToValueMap[s]; ok {
		return val, nil
	}

	if val, ok := _ServerCodeNameToValueMap[strings.ToLower(s)]; ok {
		return val, nil
	}
	return 0, fmt.Errorf("%s does not belong to ServerCode values", s)
}

// ServerCodeValues returns all values of the enum
func ServerCodeValues() []ServerCode {
	return _ServerCodeValues
}

// ServerCodeStrings returns a slice of all String values of the enum
func ServerCodeStrings() []string {
	strs := make([]string, len(_ServerCodeNames))
	copy(strs, _ServerCodeNames)
	return strs
}

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