//autogenerated:yes
//nolint:revive,misspell,govet,lll,dupl,gocritic
package ardupilotmega

import (
	"fmt"
	"strconv"
)

type MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL uint64

const (
	// Switch Low.
	MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_LOW MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL = 0
	// Switch Middle.
	MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_MIDDLE MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL = 1
	// Switch High.
	MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_HIGH MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL = 2
)

var value_to_label_MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL = map[MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL]string{
	MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_LOW:    "MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_LOW",
	MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_MIDDLE: "MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_MIDDLE",
	MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_HIGH:   "MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_HIGH",
}

var label_to_value_MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL = map[string]MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL{
	"MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_LOW":    MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_LOW,
	"MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_MIDDLE": MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_MIDDLE,
	"MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_HIGH":   MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_HIGH,
}

// MarshalText implements the encoding.TextMarshaler interface.
func (e MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL) MarshalText() ([]byte, error) {
	if name, ok := value_to_label_MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL[e]; ok {
		return []byte(name), nil
	}
	return []byte(strconv.Itoa(int(e))), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (e *MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL) UnmarshalText(text []byte) error {
	if value, ok := label_to_value_MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL[string(text)]; ok {
		*e = value
	} else if value, err := strconv.Atoi(string(text)); err == nil {
		*e = MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL(value)
	} else {
		return fmt.Errorf("invalid label '%s'", text)
	}
	return nil
}

// String implements the fmt.Stringer interface.
func (e MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL) String() string {
	val, _ := e.MarshalText()
	return string(val)
}
