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

import (
	"fmt"
	"strconv"
)

type AIRLINK_AUTH_RESPONSE_TYPE uint64

const (
	// Login or password error
	AIRLINK_ERROR_LOGIN_OR_PASS AIRLINK_AUTH_RESPONSE_TYPE = 0
	// Auth successful
	AIRLINK_AUTH_OK AIRLINK_AUTH_RESPONSE_TYPE = 1
)

var value_to_label_AIRLINK_AUTH_RESPONSE_TYPE = map[AIRLINK_AUTH_RESPONSE_TYPE]string{
	AIRLINK_ERROR_LOGIN_OR_PASS: "AIRLINK_ERROR_LOGIN_OR_PASS",
	AIRLINK_AUTH_OK:             "AIRLINK_AUTH_OK",
}

var label_to_value_AIRLINK_AUTH_RESPONSE_TYPE = map[string]AIRLINK_AUTH_RESPONSE_TYPE{
	"AIRLINK_ERROR_LOGIN_OR_PASS": AIRLINK_ERROR_LOGIN_OR_PASS,
	"AIRLINK_AUTH_OK":             AIRLINK_AUTH_OK,
}

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

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

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