func (x RejoinCountExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), RejoinCountExponent_name)
}
MarshalProtoJSON marshals the RejoinCountExponent to JSON.
package ttnpb
import (
	gogo "github.com/TheThingsIndustries/protoc-gen-go-json/gogo"
	jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
)
func (x MType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), MType_name)
}
func (x *MType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(MType_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read MType enum: %v", err)
		return
	}
	*x = MType(v)
}
func (x Major) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), Major_name)
}
var Major_customvalue = map[string]int32{
	"R1": 0,
}
func (x *Major) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(Major_value, Major_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read Major enum: %v", err)
		return
	}
	*x = Major(v)
}
func (x MACVersion) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), MACVersion_name)
}
var MACVersion_customvalue = map[string]int32{
	"UNKNOWN": 0,
	"V1_0":    1,
	"V1_0_1":  2,
	"V1_0_2":  3,
	"V1_1":    4,
	"V1_0_3":  5,
	"V1_0_4":  6,
}
func (x *MACVersion) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(MACVersion_value, MACVersion_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read MACVersion enum: %v", err)
		return
	}
	*x = MACVersion(v)
}
var PHYVersion_customname = map[int32]string{
	0: "unknown",
	1: "PHY_V1_0",
	2: "PHY_V1_0_1",
	3: "PHY_V1_0_2_REV_A",
	4: "PHY_V1_0_2_REV_B",
	5: "PHY_V1_1_REV_A",
	6: "PHY_V1_1_REV_B",
	7: "PHY_V1_0_3_REV_A",
}
func (x PHYVersion) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), PHYVersion_customname, PHYVersion_name)
}
var PHYVersion_customvalue = map[string]int32{
	"UNKNOWN":          0,
	"unknown":          0,
	"PHY_V1_0":         1,
	"1.0":              1,
	"1.0.0":            1,
	"PHY_V1_0_1":       2,
	"1.0.1":            2,
	"PHY_V1_0_2_REV_A": 3,
	"1.0.2":            3,
	"1.0.2-a":          3,
	"PHY_V1_0_2_REV_B": 4,
	"1.0.2-b":          4,
	"PHY_V1_1_REV_A":   5,
	"1.1-a":            5,
	"1.1.0-a":          5,
	"PHY_V1_1_REV_B":   6,
	"1.1-b":            6,
	"1.1.0-b":          6,
	"PHY_V1_0_3_REV_A": 7,
	"1.0.3-a":          7,
}
func (x *PHYVersion) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(PHYVersion_value, PHYVersion_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read PHYVersion enum: %v", err)
		return
	}
	*x = PHYVersion(v)
}
func (x DataRateIndex) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumNumber(int32(x))
}
var DataRateIndex_customvalue = map[string]int32{
	"0":  0,
	"1":  1,
	"2":  2,
	"3":  3,
	"4":  4,
	"5":  5,
	"6":  6,
	"7":  7,
	"8":  8,
	"9":  9,
	"10": 10,
	"11": 11,
	"12": 12,
	"13": 13,
	"14": 14,
	"15": 15,
}
func (x *DataRateIndex) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(DataRateIndex_value, DataRateIndex_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read DataRateIndex enum: %v", err)
		return
	}
	*x = DataRateIndex(v)
}
func (x DataRateOffset) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumNumber(int32(x))
}
var DataRateOffset_customvalue = map[string]int32{
	"0": 0,
	"1": 1,
	"2": 2,
	"3": 3,
	"4": 4,
	"5": 5,
	"6": 6,
	"7": 7,
}
func (x *DataRateOffset) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(DataRateOffset_value, DataRateOffset_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read DataRateOffset enum: %v", err)
		return
	}
	*x = DataRateOffset(v)
}
func (x JoinRequestType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), JoinRequestType_name)
}
func (x *JoinRequestType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(JoinRequestType_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read JoinRequestType enum: %v", err)
		return
	}
	*x = JoinRequestType(v)
}
func (x RejoinRequestType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), RejoinRequestType_name)
}
func (x *RejoinRequestType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(RejoinRequestType_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read RejoinRequestType enum: %v", err)
		return
	}
	*x = RejoinRequestType(v)
}
func (x CFListType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), CFListType_name)
}
func (x *CFListType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(CFListType_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read CFListType enum: %v", err)
		return
	}
	*x = CFListType(v)
}
func (x Class) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), Class_name)
}
var Class_customvalue = map[string]int32{
	"A": 0,
	"B": 1,
	"C": 2,
}
func (x *Class) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(Class_value, Class_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read Class enum: %v", err)
		return
	}
	*x = Class(v)
}
func (x TxSchedulePriority) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), TxSchedulePriority_name)
}
func (x *TxSchedulePriority) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(TxSchedulePriority_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read TxSchedulePriority enum: %v", err)
		return
	}
	*x = TxSchedulePriority(v)
}
func (x MACCommandIdentifier) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), MACCommandIdentifier_name)
}
var MACCommandIdentifier_customvalue = map[string]int32{
	"RFU_0":              0,
	"RESET":              1,
	"LINK_CHECK":         2,
	"LINK_ADR":           3,
	"DUTY_CYCLE":         4,
	"RX_PARAM_SETUP":     5,
	"DEV_STATUS":         6,
	"NEW_CHANNEL":        7,
	"RX_TIMING_SETUP":    8,
	"TX_PARAM_SETUP":     9,
	"DL_CHANNEL":         10,
	"REKEY":              11,
	"ADR_PARAM_SETUP":    12,
	"DEVICE_TIME":        13,
	"FORCE_REJOIN":       14,
	"REJOIN_PARAM_SETUP": 15,
	"PING_SLOT_INFO":     16,
	"PING_SLOT_CHANNEL":  17,
	"BEACON_TIMING":      18,
	"BEACON_FREQ":        19,
	"DEVICE_MODE":        32,
}
func (x *MACCommandIdentifier) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(MACCommandIdentifier_value, MACCommandIdentifier_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read MACCommandIdentifier enum: %v", err)
		return
	}
	*x = MACCommandIdentifier(v)
}
func (x AggregatedDutyCycle) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), AggregatedDutyCycle_name)
}
var AggregatedDutyCycle_customvalue = map[string]int32{
	"1":     0,
	"2":     1,
	"4":     2,
	"8":     3,
	"16":    4,
	"32":    5,
	"64":    6,
	"128":   7,
	"256":   8,
	"512":   9,
	"1024":  10,
	"2048":  11,
	"4096":  12,
	"8192":  13,
	"16384": 14,
	"32768": 15,
}
func (x *AggregatedDutyCycle) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(AggregatedDutyCycle_value, AggregatedDutyCycle_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read AggregatedDutyCycle enum: %v", err)
		return
	}
	*x = AggregatedDutyCycle(v)
}
func (x PingSlotPeriod) MarshalProtoJSON(s *jsonplugin.MarshalState) {
	s.WriteEnumString(int32(x), PingSlotPeriod_name)
}
var PingSlotPeriod_customvalue = map[string]int32{
	"1S":   0,
	"2S":   1,
	"4S":   2,
	"8S":   3,
	"16S":  4,
	"32S":  5,
	"64S":  6,
	"128S": 7,
}
func (x *PingSlotPeriod) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
	v := s.ReadEnum(PingSlotPeriod_value, PingSlotPeriod_customvalue)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read PingSlotPeriod enum: %v", err)
		return
	}
	*x = PingSlotPeriod(v)
}