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

import (
	"fmt"
	"strconv"
)

type GOPRO_FRAME_RATE uint64

const (
	// 12 FPS.
	GOPRO_FRAME_RATE_12 GOPRO_FRAME_RATE = 0
	// 15 FPS.
	GOPRO_FRAME_RATE_15 GOPRO_FRAME_RATE = 1
	// 24 FPS.
	GOPRO_FRAME_RATE_24 GOPRO_FRAME_RATE = 2
	// 25 FPS.
	GOPRO_FRAME_RATE_25 GOPRO_FRAME_RATE = 3
	// 30 FPS.
	GOPRO_FRAME_RATE_30 GOPRO_FRAME_RATE = 4
	// 48 FPS.
	GOPRO_FRAME_RATE_48 GOPRO_FRAME_RATE = 5
	// 50 FPS.
	GOPRO_FRAME_RATE_50 GOPRO_FRAME_RATE = 6
	// 60 FPS.
	GOPRO_FRAME_RATE_60 GOPRO_FRAME_RATE = 7
	// 80 FPS.
	GOPRO_FRAME_RATE_80 GOPRO_FRAME_RATE = 8
	// 90 FPS.
	GOPRO_FRAME_RATE_90 GOPRO_FRAME_RATE = 9
	// 100 FPS.
	GOPRO_FRAME_RATE_100 GOPRO_FRAME_RATE = 10
	// 120 FPS.
	GOPRO_FRAME_RATE_120 GOPRO_FRAME_RATE = 11
	// 240 FPS.
	GOPRO_FRAME_RATE_240 GOPRO_FRAME_RATE = 12
	// 12.5 FPS.
	GOPRO_FRAME_RATE_12_5 GOPRO_FRAME_RATE = 13
)

var value_to_label_GOPRO_FRAME_RATE = map[GOPRO_FRAME_RATE]string{
	GOPRO_FRAME_RATE_12:   "GOPRO_FRAME_RATE_12",
	GOPRO_FRAME_RATE_15:   "GOPRO_FRAME_RATE_15",
	GOPRO_FRAME_RATE_24:   "GOPRO_FRAME_RATE_24",
	GOPRO_FRAME_RATE_25:   "GOPRO_FRAME_RATE_25",
	GOPRO_FRAME_RATE_30:   "GOPRO_FRAME_RATE_30",
	GOPRO_FRAME_RATE_48:   "GOPRO_FRAME_RATE_48",
	GOPRO_FRAME_RATE_50:   "GOPRO_FRAME_RATE_50",
	GOPRO_FRAME_RATE_60:   "GOPRO_FRAME_RATE_60",
	GOPRO_FRAME_RATE_80:   "GOPRO_FRAME_RATE_80",
	GOPRO_FRAME_RATE_90:   "GOPRO_FRAME_RATE_90",
	GOPRO_FRAME_RATE_100:  "GOPRO_FRAME_RATE_100",
	GOPRO_FRAME_RATE_120:  "GOPRO_FRAME_RATE_120",
	GOPRO_FRAME_RATE_240:  "GOPRO_FRAME_RATE_240",
	GOPRO_FRAME_RATE_12_5: "GOPRO_FRAME_RATE_12_5",
}

var label_to_value_GOPRO_FRAME_RATE = map[string]GOPRO_FRAME_RATE{
	"GOPRO_FRAME_RATE_12":   GOPRO_FRAME_RATE_12,
	"GOPRO_FRAME_RATE_15":   GOPRO_FRAME_RATE_15,
	"GOPRO_FRAME_RATE_24":   GOPRO_FRAME_RATE_24,
	"GOPRO_FRAME_RATE_25":   GOPRO_FRAME_RATE_25,
	"GOPRO_FRAME_RATE_30":   GOPRO_FRAME_RATE_30,
	"GOPRO_FRAME_RATE_48":   GOPRO_FRAME_RATE_48,
	"GOPRO_FRAME_RATE_50":   GOPRO_FRAME_RATE_50,
	"GOPRO_FRAME_RATE_60":   GOPRO_FRAME_RATE_60,
	"GOPRO_FRAME_RATE_80":   GOPRO_FRAME_RATE_80,
	"GOPRO_FRAME_RATE_90":   GOPRO_FRAME_RATE_90,
	"GOPRO_FRAME_RATE_100":  GOPRO_FRAME_RATE_100,
	"GOPRO_FRAME_RATE_120":  GOPRO_FRAME_RATE_120,
	"GOPRO_FRAME_RATE_240":  GOPRO_FRAME_RATE_240,
	"GOPRO_FRAME_RATE_12_5": GOPRO_FRAME_RATE_12_5,
}

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

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

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