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

package storage

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 easyjson4da0dabeDecodeGoStdSrcStorage(in *jlexer.Lexer, out *Worlds) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		in.Skip()
		*out = nil
	} else {
		in.Delim('[')
		if *out == nil {
			if !in.IsDelim(']') {
				*out = make(Worlds, 0, 4)
			} else {
				*out = Worlds{}
			}
		} else {
			*out = (*out)[:0]
		}
		for !in.IsDelim(']') {
			var v1 World
			(v1).UnmarshalEasyJSON(in)
			*out = append(*out, v1)
			in.WantComma()
		}
		in.Delim(']')
	}
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson4da0dabeEncodeGoStdSrcStorage(out *jwriter.Writer, in Worlds) {
	if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
		out.RawString("null")
	} else {
		out.RawByte('[')
		for v2, v3 := range in {
			if v2 > 0 {
				out.RawByte(',')
			}
			(v3).MarshalEasyJSON(out)
		}
		out.RawByte(']')
	}
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Worlds) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson4da0dabeDecodeGoStdSrcStorage(l, v)
}
func easyjson4da0dabeDecodeGoStdSrcStorage1(in *jlexer.Lexer, out *World) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(true)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "id":
			out.ID = int(in.Int())
		case "randomnumber":
			out.RandomNumber = int(in.Int())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson4da0dabeEncodeGoStdSrcStorage1(out *jwriter.Writer, in World) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"id\":"
		out.RawString(prefix[1:])
		out.Int(int(in.ID))
	}
	{
		const prefix string = ",\"randomnumber\":"
		out.RawString(prefix)
		out.Int(int(in.RandomNumber))
	}
	out.RawByte('}')
}

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

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

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

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