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

import (
	"fmt"
	"strconv"
)

type MAV_STORM32_TUNNEL_PAYLOAD_TYPE uint64

const (
	// Registered for STorM32 gimbal controller. For communication with gimbal or camera.
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_IN MAV_STORM32_TUNNEL_PAYLOAD_TYPE = 200
	// Registered for STorM32 gimbal controller. For communication with gimbal or camera.
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_OUT MAV_STORM32_TUNNEL_PAYLOAD_TYPE = 201
	// Registered for STorM32 gimbal controller. For communication with gimbal.
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_IN MAV_STORM32_TUNNEL_PAYLOAD_TYPE = 202
	// Registered for STorM32 gimbal controller. For communication with gimbal.
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_OUT MAV_STORM32_TUNNEL_PAYLOAD_TYPE = 203
	// Registered for STorM32 gimbal controller. For communication with camera.
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_IN MAV_STORM32_TUNNEL_PAYLOAD_TYPE = 204
	// Registered for STorM32 gimbal controller. For communication with camera.
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_OUT MAV_STORM32_TUNNEL_PAYLOAD_TYPE = 205
)

var value_to_label_MAV_STORM32_TUNNEL_PAYLOAD_TYPE = map[MAV_STORM32_TUNNEL_PAYLOAD_TYPE]string{
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_IN:  "MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_IN",
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_OUT: "MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_OUT",
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_IN:  "MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_IN",
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_OUT: "MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_OUT",
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_IN:  "MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_IN",
	MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_OUT: "MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_OUT",
}

var label_to_value_MAV_STORM32_TUNNEL_PAYLOAD_TYPE = map[string]MAV_STORM32_TUNNEL_PAYLOAD_TYPE{
	"MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_IN":  MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_IN,
	"MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_OUT": MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH1_OUT,
	"MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_IN":  MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_IN,
	"MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_OUT": MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH2_OUT,
	"MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_IN":  MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_IN,
	"MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_OUT": MAV_STORM32_TUNNEL_PAYLOAD_TYPE_STORM32_CH3_OUT,
}

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

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

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