// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.

package bluetoothemulation

import (
	json "encoding/json"
	easyjson "github.com/mailru/easyjson"
	jlexer "github.com/mailru/easyjson/jlexer"
	jwriter "github.com/mailru/easyjson/jwriter"
)

// suppress unused package warning
var (
	_ *json.RawMessage
	_ *jlexer.Lexer
	_ *jwriter.Writer
	_ easyjson.Marshaler
)

func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation(in *jlexer.Lexer, out *SimulatePreconnectedPeripheralParams) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "address":
			out.Address = string(in.String())
		case "name":
			out.Name = string(in.String())
		case "manufacturerData":
			if in.IsNull() {
				in.Skip()
				out.ManufacturerData = nil
			} else {
				in.Delim('[')
				if out.ManufacturerData == nil {
					if !in.IsDelim(']') {
						out.ManufacturerData = make([]*ManufacturerData, 0, 8)
					} else {
						out.ManufacturerData = []*ManufacturerData{}
					}
				} else {
					out.ManufacturerData = (out.ManufacturerData)[:0]
				}
				for !in.IsDelim(']') {
					var v1 *ManufacturerData
					if in.IsNull() {
						in.Skip()
						v1 = nil
					} else {
						if v1 == nil {
							v1 = new(ManufacturerData)
						}
						(*v1).UnmarshalEasyJSON(in)
					}
					out.ManufacturerData = append(out.ManufacturerData, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "knownServiceUuids":
			if in.IsNull() {
				in.Skip()
				out.KnownServiceUuids = nil
			} else {
				in.Delim('[')
				if out.KnownServiceUuids == nil {
					if !in.IsDelim(']') {
						out.KnownServiceUuids = make([]string, 0, 4)
					} else {
						out.KnownServiceUuids = []string{}
					}
				} else {
					out.KnownServiceUuids = (out.KnownServiceUuids)[:0]
				}
				for !in.IsDelim(']') {
					var v2 string
					v2 = string(in.String())
					out.KnownServiceUuids = append(out.KnownServiceUuids, v2)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation(out *jwriter.Writer, in SimulatePreconnectedPeripheralParams) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"address\":"
		out.RawString(prefix[1:])
		out.String(string(in.Address))
	}
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix)
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"manufacturerData\":"
		out.RawString(prefix)
		if in.ManufacturerData == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v3, v4 := range in.ManufacturerData {
				if v3 > 0 {
					out.RawByte(',')
				}
				if v4 == nil {
					out.RawString("null")
				} else {
					(*v4).MarshalEasyJSON(out)
				}
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"knownServiceUuids\":"
		out.RawString(prefix)
		if in.KnownServiceUuids == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v5, v6 := range in.KnownServiceUuids {
				if v5 > 0 {
					out.RawByte(',')
				}
				out.String(string(v6))
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v SimulatePreconnectedPeripheralParams) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SimulatePreconnectedPeripheralParams) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *SimulatePreconnectedPeripheralParams) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SimulatePreconnectedPeripheralParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation1(in *jlexer.Lexer, out *SimulateAdvertisementParams) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "entry":
			if in.IsNull() {
				in.Skip()
				out.Entry = nil
			} else {
				if out.Entry == nil {
					out.Entry = new(ScanEntry)
				}
				(*out.Entry).UnmarshalEasyJSON(in)
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation1(out *jwriter.Writer, in SimulateAdvertisementParams) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"entry\":"
		out.RawString(prefix[1:])
		if in.Entry == nil {
			out.RawString("null")
		} else {
			(*in.Entry).MarshalEasyJSON(out)
		}
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v SimulateAdvertisementParams) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SimulateAdvertisementParams) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation1(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *SimulateAdvertisementParams) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation1(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SimulateAdvertisementParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation2(in *jlexer.Lexer, out *ScanRecord) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "name":
			out.Name = string(in.String())
		case "uuids":
			if in.IsNull() {
				in.Skip()
				out.Uuids = nil
			} else {
				in.Delim('[')
				if out.Uuids == nil {
					if !in.IsDelim(']') {
						out.Uuids = make([]string, 0, 4)
					} else {
						out.Uuids = []string{}
					}
				} else {
					out.Uuids = (out.Uuids)[:0]
				}
				for !in.IsDelim(']') {
					var v7 string
					v7 = string(in.String())
					out.Uuids = append(out.Uuids, v7)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "appearance":
			out.Appearance = int64(in.Int64())
		case "txPower":
			out.TxPower = int64(in.Int64())
		case "manufacturerData":
			if in.IsNull() {
				in.Skip()
				out.ManufacturerData = nil
			} else {
				in.Delim('[')
				if out.ManufacturerData == nil {
					if !in.IsDelim(']') {
						out.ManufacturerData = make([]*ManufacturerData, 0, 8)
					} else {
						out.ManufacturerData = []*ManufacturerData{}
					}
				} else {
					out.ManufacturerData = (out.ManufacturerData)[:0]
				}
				for !in.IsDelim(']') {
					var v8 *ManufacturerData
					if in.IsNull() {
						in.Skip()
						v8 = nil
					} else {
						if v8 == nil {
							v8 = new(ManufacturerData)
						}
						(*v8).UnmarshalEasyJSON(in)
					}
					out.ManufacturerData = append(out.ManufacturerData, v8)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation2(out *jwriter.Writer, in ScanRecord) {
	out.RawByte('{')
	first := true
	_ = first
	if in.Name != "" {
		const prefix string = ",\"name\":"
		first = false
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	if len(in.Uuids) != 0 {
		const prefix string = ",\"uuids\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		{
			out.RawByte('[')
			for v9, v10 := range in.Uuids {
				if v9 > 0 {
					out.RawByte(',')
				}
				out.String(string(v10))
			}
			out.RawByte(']')
		}
	}
	if in.Appearance != 0 {
		const prefix string = ",\"appearance\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int64(int64(in.Appearance))
	}
	if in.TxPower != 0 {
		const prefix string = ",\"txPower\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int64(int64(in.TxPower))
	}
	if len(in.ManufacturerData) != 0 {
		const prefix string = ",\"manufacturerData\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		{
			out.RawByte('[')
			for v11, v12 := range in.ManufacturerData {
				if v11 > 0 {
					out.RawByte(',')
				}
				if v12 == nil {
					out.RawString("null")
				} else {
					(*v12).MarshalEasyJSON(out)
				}
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v ScanRecord) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation2(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ScanRecord) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation2(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *ScanRecord) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation2(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ScanRecord) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation3(in *jlexer.Lexer, out *ScanEntry) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "deviceAddress":
			out.DeviceAddress = string(in.String())
		case "rssi":
			out.Rssi = int64(in.Int64())
		case "scanRecord":
			if in.IsNull() {
				in.Skip()
				out.ScanRecord = nil
			} else {
				if out.ScanRecord == nil {
					out.ScanRecord = new(ScanRecord)
				}
				(*out.ScanRecord).UnmarshalEasyJSON(in)
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation3(out *jwriter.Writer, in ScanEntry) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"deviceAddress\":"
		out.RawString(prefix[1:])
		out.String(string(in.DeviceAddress))
	}
	{
		const prefix string = ",\"rssi\":"
		out.RawString(prefix)
		out.Int64(int64(in.Rssi))
	}
	{
		const prefix string = ",\"scanRecord\":"
		out.RawString(prefix)
		if in.ScanRecord == nil {
			out.RawString("null")
		} else {
			(*in.ScanRecord).MarshalEasyJSON(out)
		}
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v ScanEntry) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ScanEntry) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation3(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *ScanEntry) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation3(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ScanEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation4(in *jlexer.Lexer, out *ManufacturerData) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "key":
			out.Key = int64(in.Int64())
		case "data":
			out.Data = string(in.String())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation4(out *jwriter.Writer, in ManufacturerData) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"key\":"
		out.RawString(prefix[1:])
		out.Int64(int64(in.Key))
	}
	{
		const prefix string = ",\"data\":"
		out.RawString(prefix)
		out.String(string(in.Data))
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v ManufacturerData) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation4(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ManufacturerData) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation4(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *ManufacturerData) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation4(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ManufacturerData) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation4(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation5(in *jlexer.Lexer, out *EnableParams) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "state":
			(out.State).UnmarshalEasyJSON(in)
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation5(out *jwriter.Writer, in EnableParams) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"state\":"
		out.RawString(prefix[1:])
		(in.State).MarshalEasyJSON(out)
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation5(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation5(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation5(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation5(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation6(in *jlexer.Lexer, out *DisableParams) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation6(out *jwriter.Writer, in DisableParams) {
	out.RawByte('{')
	first := true
	_ = first
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation6(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonC5a4559bEncodeGithubComChromedpCdprotoBluetoothemulation6(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation6(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoBluetoothemulation6(l, v)
}
