func (v PHYVersion) MarshalBinary() ([]byte, error) {
	return marshalBinaryEnum(int32(v)), nil
}
MarshalBinary implements encoding.BinaryMarshaler interface.
package ttnpb
import (
	"encoding/json"
	"fmt"
	"strconv"
	"time"
	"github.com/blang/semver"
	"github.com/gogo/protobuf/jsonpb"
	"github.com/vmihailenco/msgpack/v5"
	"go.thethings.network/lorawan-stack/v3/pkg/errors"
	"go.thethings.network/lorawan-stack/v3/pkg/types"
)
var PHYVersionCompatibleName = map[int32]string{}
func init() {
	for i := range PHYVersion_name {
		PHYVersion_value[PHYVersion(i).String()] = i
	}
	for name, version := range map[string]PHYVersion{
		"1.0":   TS001_V1_0,        
		"1.0.2": RP001_V1_0_2,      
		"1.1-a": RP001_V1_1_REV_A,  
		"1.1-b": RP001_V1_1_REV_B,  
	} {
		PHYVersion_value[name] = int32(version)
	}
	for version, name := range PHYVersion_name {
		PHYVersionCompatibleName[version] = name
	}
	for name, version := range map[string]PHYVersion{
		"PHY_V1_0":         TS001_V1_0,
		"PHY_V1_0_1":       TS001_V1_0_1,
		"PHY_V1_0_2_REV_A": RP001_V1_0_2,
		"PHY_V1_0_2_REV_B": RP001_V1_0_2_REV_B,
		"PHY_V1_1_REV_A":   RP001_V1_1_REV_A,
		"PHY_V1_1_REV_B":   RP001_V1_1_REV_B,
		"PHY_V1_0_3_REV_A": RP001_V1_0_3_REV_A,
	} {
		PHYVersion_value[name] = int32(version)
		PHYVersionCompatibleName[int32(version)] = name
	}
}
func (v MType) MarshalBinary() ([]byte, error) {
	return marshalBinaryEnum(int32(v)), nil
}
func (v MType) MarshalText() ([]byte, error) {
	return []byte(v.String()), nil
}
func (v MType) MarshalJSON() ([]byte, error) {
	return marshalJSONEnum(MType_name, int32(v))
}
func (v *MType) UnmarshalBinary(b []byte) error {
	i, err := unmarshalEnumFromBinary("MType", MType_name, b)
	if err != nil {
		return err
	}
	*v = MType(i)
	return nil
}
func (v *MType) UnmarshalText(b []byte) error {
	i, err := unmarshalEnumFromText("MType", MType_value, b)
	if err != nil {
		return err
	}
	*v = MType(i)
	return nil
}
func (v *MType) UnmarshalJSON(b []byte) error {
	if bt, ok := unmarshalJSONString(b); ok {
		return v.UnmarshalText(bt)
	}
	i, err := unmarshalEnumFromNumber("MType", MType_name, b)
	if err != nil {
		return err
	}
	*v = MType(i)
	return nil
}
func (v Major) MarshalBinary() ([]byte, error) {
	return marshalBinaryEnum(int32(v)), nil
}
func (v Major) MarshalText() ([]byte, error) {
	return []byte(v.String()), nil
}
func (v Major) MarshalJSON() ([]byte, error) {
	return marshalJSONEnum(Major_name, int32(v))
}
func (v *Major) UnmarshalBinary(b []byte) error {
	i, err := unmarshalEnumFromBinary("Major", Major_name, b)
	if err != nil {
		return err
	}
	*v = Major(i)
	return nil
}
func (v *Major) UnmarshalText(b []byte) error {
	i, err := unmarshalEnumFromTextPrefix("Major", Major_value, "LORAWAN_", b)
	if err != nil {
		return err
	}
	*v = Major(i)
	return nil
}
func (v *Major) UnmarshalJSON(b []byte) error {
	if bt, ok := unmarshalJSONString(b); ok {
		return v.UnmarshalText(bt)
	}
	i, err := unmarshalEnumFromNumber("Major", Major_name, b)
	if err != nil {
		return err
	}
	*v = Major(i)
	return nil
}
func (v MACVersion) MarshalBinary() ([]byte, error) {
	return marshalBinaryEnum(int32(v)), nil
}
func (v MACVersion) MarshalText() ([]byte, error) {
	return []byte(v.String()), nil
}
func (v MACVersion) MarshalJSON() ([]byte, error) {
	return marshalJSONEnum(MACVersion_name, int32(v))
}
func (v MACVersion) EncodeMsgpack(enc *msgpack.Encoder) error {
	if v > 255 {
		panic(fmt.Errorf("MACVersion enum exceeds 255"))
	}
	return enc.EncodeUint8(uint8(v))
}
func (v *MACVersion) UnmarshalBinary(b []byte) error {
	i, err := unmarshalEnumFromBinary("MACVersion", MACVersion_name, b)
	if err != nil {
		return err
	}
	*v = MACVersion(i)
	return nil
}
func (v *MACVersion) UnmarshalText(b []byte) error {
	i, err := unmarshalEnumFromTextPrefix("MACVersion", MACVersion_value, "MAC_", b)
	if err != nil {
		return err
	}
	*v = MACVersion(i)
	return nil
}
func (v *MACVersion) UnmarshalJSON(b []byte) error {
	if bt, ok := unmarshalJSONString(b); ok {
		return v.UnmarshalText(bt)
	}
	i, err := unmarshalEnumFromNumber("MACVersion", MACVersion_name, b)
	if err != nil {
		return err
	}
	*v = MACVersion(i)
	return nil
}
func (v *MACVersion) DecodeMsgpack(dec *msgpack.Decoder) error {
	i, err := dec.DecodeInt32()
	if err != nil {
		return err
	}
	*v = MACVersion(i)
	return nil
}