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

package bench

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 easyjson4d24a18fDecodeBench(in *jlexer.Lexer, out *SmallAuthor) {
	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 "age":
			out.Age = int(in.Int())
		case "male":
			out.Male = bool(in.Bool())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson4d24a18fEncodeBench(out *jwriter.Writer, in SmallAuthor) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"age\":"
		out.RawString(prefix)
		out.Int(int(in.Age))
	}
	{
		const prefix string = ",\"male\":"
		out.RawString(prefix)
		out.Bool(bool(in.Male))
	}
	out.RawByte('}')
}

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SmallAuthor) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson4d24a18fDecodeBench(l, v)
}
func easyjson4d24a18fDecodeBench1(in *jlexer.Lexer, out *Small) {
	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 "id":
			out.BookId = int(in.Int())
		case "ids":
			if in.IsNull() {
				in.Skip()
				out.BookIds = nil
			} else {
				in.Delim('[')
				if out.BookIds == nil {
					if !in.IsDelim(']') {
						out.BookIds = make([]int, 0, 8)
					} else {
						out.BookIds = []int{}
					}
				} else {
					out.BookIds = (out.BookIds)[:0]
				}
				for !in.IsDelim(']') {
					var v1 int
					v1 = int(in.Int())
					out.BookIds = append(out.BookIds, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "title":
			out.Title = string(in.String())
		case "titles":
			if in.IsNull() {
				in.Skip()
				out.Titles = nil
			} else {
				in.Delim('[')
				if out.Titles == nil {
					if !in.IsDelim(']') {
						out.Titles = make([]string, 0, 4)
					} else {
						out.Titles = []string{}
					}
				} else {
					out.Titles = (out.Titles)[:0]
				}
				for !in.IsDelim(']') {
					var v2 string
					v2 = string(in.String())
					out.Titles = append(out.Titles, v2)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "price":
			out.Price = float64(in.Float64())
		case "prices":
			if in.IsNull() {
				in.Skip()
				out.Prices = nil
			} else {
				in.Delim('[')
				if out.Prices == nil {
					if !in.IsDelim(']') {
						out.Prices = make([]float64, 0, 8)
					} else {
						out.Prices = []float64{}
					}
				} else {
					out.Prices = (out.Prices)[:0]
				}
				for !in.IsDelim(']') {
					var v3 float64
					v3 = float64(in.Float64())
					out.Prices = append(out.Prices, v3)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "hot":
			out.Hot = bool(in.Bool())
		case "hots":
			if in.IsNull() {
				in.Skip()
				out.Hots = nil
			} else {
				in.Delim('[')
				if out.Hots == nil {
					if !in.IsDelim(']') {
						out.Hots = make([]bool, 0, 64)
					} else {
						out.Hots = []bool{}
					}
				} else {
					out.Hots = (out.Hots)[:0]
				}
				for !in.IsDelim(']') {
					var v4 bool
					v4 = bool(in.Bool())
					out.Hots = append(out.Hots, v4)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "author":
			(out.Author).UnmarshalEasyJSON(in)
		case "authors":
			if in.IsNull() {
				in.Skip()
				out.Authors = nil
			} else {
				in.Delim('[')
				if out.Authors == nil {
					if !in.IsDelim(']') {
						out.Authors = make([]SmallAuthor, 0, 2)
					} else {
						out.Authors = []SmallAuthor{}
					}
				} else {
					out.Authors = (out.Authors)[:0]
				}
				for !in.IsDelim(']') {
					var v5 SmallAuthor
					(v5).UnmarshalEasyJSON(in)
					out.Authors = append(out.Authors, v5)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "weights":
			if in.IsNull() {
				in.Skip()
				out.Weights = nil
			} else {
				in.Delim('[')
				if out.Weights == nil {
					if !in.IsDelim(']') {
						out.Weights = make([]int, 0, 8)
					} else {
						out.Weights = []int{}
					}
				} else {
					out.Weights = (out.Weights)[:0]
				}
				for !in.IsDelim(']') {
					var v6 int
					v6 = int(in.Int())
					out.Weights = append(out.Weights, v6)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson4d24a18fEncodeBench1(out *jwriter.Writer, in Small) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"id\":"
		out.RawString(prefix[1:])
		out.Int(int(in.BookId))
	}
	{
		const prefix string = ",\"ids\":"
		out.RawString(prefix)
		if in.BookIds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v7, v8 := range in.BookIds {
				if v7 > 0 {
					out.RawByte(',')
				}
				out.Int(int(v8))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"title\":"
		out.RawString(prefix)
		out.String(string(in.Title))
	}
	{
		const prefix string = ",\"titles\":"
		out.RawString(prefix)
		if in.Titles == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v9, v10 := range in.Titles {
				if v9 > 0 {
					out.RawByte(',')
				}
				out.String(string(v10))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"price\":"
		out.RawString(prefix)
		out.Float64(float64(in.Price))
	}
	{
		const prefix string = ",\"prices\":"
		out.RawString(prefix)
		if in.Prices == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v11, v12 := range in.Prices {
				if v11 > 0 {
					out.RawByte(',')
				}
				out.Float64(float64(v12))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"hot\":"
		out.RawString(prefix)
		out.Bool(bool(in.Hot))
	}
	{
		const prefix string = ",\"hots\":"
		out.RawString(prefix)
		if in.Hots == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v13, v14 := range in.Hots {
				if v13 > 0 {
					out.RawByte(',')
				}
				out.Bool(bool(v14))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"author\":"
		out.RawString(prefix)
		(in.Author).MarshalEasyJSON(out)
	}
	{
		const prefix string = ",\"authors\":"
		out.RawString(prefix)
		if in.Authors == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v15, v16 := range in.Authors {
				if v15 > 0 {
					out.RawByte(',')
				}
				(v16).MarshalEasyJSON(out)
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"weights\":"
		out.RawString(prefix)
		if in.Weights == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v17, v18 := range in.Weights {
				if v17 > 0 {
					out.RawByte(',')
				}
				out.Int(int(v18))
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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