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

import (
	"fmt"
	"strconv"
)

type GIMBAL_AXIS_CALIBRATION_STATUS uint64

const (
	// Axis calibration is in progress.
	GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS GIMBAL_AXIS_CALIBRATION_STATUS = 0
	// Axis calibration succeeded.
	GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED GIMBAL_AXIS_CALIBRATION_STATUS = 1
	// Axis calibration failed.
	GIMBAL_AXIS_CALIBRATION_STATUS_FAILED GIMBAL_AXIS_CALIBRATION_STATUS = 2
)

var value_to_label_GIMBAL_AXIS_CALIBRATION_STATUS = map[GIMBAL_AXIS_CALIBRATION_STATUS]string{
	GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS: "GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS",
	GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED:   "GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED",
	GIMBAL_AXIS_CALIBRATION_STATUS_FAILED:      "GIMBAL_AXIS_CALIBRATION_STATUS_FAILED",
}

var label_to_value_GIMBAL_AXIS_CALIBRATION_STATUS = map[string]GIMBAL_AXIS_CALIBRATION_STATUS{
	"GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS": GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS,
	"GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED":   GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED,
	"GIMBAL_AXIS_CALIBRATION_STATUS_FAILED":      GIMBAL_AXIS_CALIBRATION_STATUS_FAILED,
}

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

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

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