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

import (
	"fmt"
	"strconv"
)

// GPS longitudinal offset encoding
type UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON uint64

const (
	UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_NO_DATA           UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON = 0
	UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_APPLIED_BY_SENSOR UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON = 1
)

var value_to_label_UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON = map[UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON]string{
	UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_NO_DATA:           "UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_NO_DATA",
	UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_APPLIED_BY_SENSOR: "UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_APPLIED_BY_SENSOR",
}

var label_to_value_UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON = map[string]UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON{
	"UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_NO_DATA":           UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_NO_DATA,
	"UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_APPLIED_BY_SENSOR": UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_APPLIED_BY_SENSOR,
}

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

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

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