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

package librariesindex

import (
	json "encoding/json"
	easyjson "github.com/mailru/easyjson"
	jlexer "github.com/mailru/easyjson/jlexer"
	jwriter "github.com/mailru/easyjson/jwriter"
	relaxed_semver "go.bug.st/relaxed-semver"
	strings "strings"
)

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

func easyjson42239ddeDecodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex(in *jlexer.Lexer, out *indexRelease) {
	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 "version":
			if in.IsNull() {
				in.Skip()
				out.Version = nil
			} else {
				if out.Version == nil {
					out.Version = new(relaxed_semver.Version)
				}
				if data := in.Raw(); in.Ok() {
					in.AddError((*out.Version).UnmarshalJSON(data))
				}
			}
		case "author":
			out.Author = string(in.String())
		case "maintainer":
			out.Maintainer = string(in.String())
		case "sentence":
			out.Sentence = string(in.String())
		case "paragraph":
			out.Paragraph = string(in.String())
		case "website":
			out.Website = string(in.String())
		case "category":
			out.Category = string(in.String())
		case "architectures":
			if in.IsNull() {
				in.Skip()
				out.Architectures = nil
			} else {
				in.Delim('[')
				if out.Architectures == nil {
					if !in.IsDelim(']') {
						out.Architectures = make([]string, 0, 4)
					} else {
						out.Architectures = []string{}
					}
				} else {
					out.Architectures = (out.Architectures)[:0]
				}
				for !in.IsDelim(']') {
					var v1 string
					v1 = string(in.String())
					out.Architectures = append(out.Architectures, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "types":
			if in.IsNull() {
				in.Skip()
				out.Types = nil
			} else {
				in.Delim('[')
				if out.Types == nil {
					if !in.IsDelim(']') {
						out.Types = make([]string, 0, 4)
					} else {
						out.Types = []string{}
					}
				} else {
					out.Types = (out.Types)[:0]
				}
				for !in.IsDelim(']') {
					var v2 string
					v2 = string(in.String())
					out.Types = append(out.Types, v2)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "url":
			out.URL = string(in.String())
		case "archiveFileName":
			out.ArchiveFileName = string(in.String())
		case "size":
			out.Size = int64(in.Int64())
		case "checksum":
			out.Checksum = string(in.String())
		case "dependencies":
			if in.IsNull() {
				in.Skip()
				out.Dependencies = nil
			} else {
				in.Delim('[')
				if out.Dependencies == nil {
					if !in.IsDelim(']') {
						out.Dependencies = make([]*indexDependency, 0, 8)
					} else {
						out.Dependencies = []*indexDependency{}
					}
				} else {
					out.Dependencies = (out.Dependencies)[:0]
				}
				for !in.IsDelim(']') {
					var v3 *indexDependency
					if in.IsNull() {
						in.Skip()
						v3 = nil
					} else {
						if v3 == nil {
							v3 = new(indexDependency)
						}
						(*v3).UnmarshalEasyJSON(in)
					}
					out.Dependencies = append(out.Dependencies, v3)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "license":
			out.License = string(in.String())
		case "providesIncludes":
			if in.IsNull() {
				in.Skip()
				out.ProvidesIncludes = nil
			} else {
				in.Delim('[')
				if out.ProvidesIncludes == nil {
					if !in.IsDelim(']') {
						out.ProvidesIncludes = make([]string, 0, 4)
					} else {
						out.ProvidesIncludes = []string{}
					}
				} else {
					out.ProvidesIncludes = (out.ProvidesIncludes)[:0]
				}
				for !in.IsDelim(']') {
					var v4 string
					v4 = string(in.String())
					out.ProvidesIncludes = append(out.ProvidesIncludes, v4)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			switch strings.ToLower(key) {
			case "name":
				out.Name = string(in.String())
			case "version":
				if in.IsNull() {
					in.Skip()
					out.Version = nil
				} else {
					if out.Version == nil {
						out.Version = new(relaxed_semver.Version)
					}
					if data := in.Raw(); in.Ok() {
						in.AddError((*out.Version).UnmarshalJSON(data))
					}
				}
			case "author":
				out.Author = string(in.String())
			case "maintainer":
				out.Maintainer = string(in.String())
			case "sentence":
				out.Sentence = string(in.String())
			case "paragraph":
				out.Paragraph = string(in.String())
			case "website":
				out.Website = string(in.String())
			case "category":
				out.Category = string(in.String())
			case "architectures":
				if in.IsNull() {
					in.Skip()
					out.Architectures = nil
				} else {
					in.Delim('[')
					if out.Architectures == nil {
						if !in.IsDelim(']') {
							out.Architectures = make([]string, 0, 4)
						} else {
							out.Architectures = []string{}
						}
					} else {
						out.Architectures = (out.Architectures)[:0]
					}
					for !in.IsDelim(']') {
						var v5 string
						v5 = string(in.String())
						out.Architectures = append(out.Architectures, v5)
						in.WantComma()
					}
					in.Delim(']')
				}
			case "types":
				if in.IsNull() {
					in.Skip()
					out.Types = nil
				} else {
					in.Delim('[')
					if out.Types == nil {
						if !in.IsDelim(']') {
							out.Types = make([]string, 0, 4)
						} else {
							out.Types = []string{}
						}
					} else {
						out.Types = (out.Types)[:0]
					}
					for !in.IsDelim(']') {
						var v6 string
						v6 = string(in.String())
						out.Types = append(out.Types, v6)
						in.WantComma()
					}
					in.Delim(']')
				}
			case "url":
				out.URL = string(in.String())
			case "archivefilename":
				out.ArchiveFileName = string(in.String())
			case "size":
				out.Size = int64(in.Int64())
			case "checksum":
				out.Checksum = string(in.String())
			case "dependencies":
				if in.IsNull() {
					in.Skip()
					out.Dependencies = nil
				} else {
					in.Delim('[')
					if out.Dependencies == nil {
						if !in.IsDelim(']') {
							out.Dependencies = make([]*indexDependency, 0, 8)
						} else {
							out.Dependencies = []*indexDependency{}
						}
					} else {
						out.Dependencies = (out.Dependencies)[:0]
					}
					for !in.IsDelim(']') {
						var v7 *indexDependency
						if in.IsNull() {
							in.Skip()
							v7 = nil
						} else {
							if v7 == nil {
								v7 = new(indexDependency)
							}
							(*v7).UnmarshalEasyJSON(in)
						}
						out.Dependencies = append(out.Dependencies, v7)
						in.WantComma()
					}
					in.Delim(']')
				}
			case "license":
				out.License = string(in.String())
			case "providesincludes":
				if in.IsNull() {
					in.Skip()
					out.ProvidesIncludes = nil
				} else {
					in.Delim('[')
					if out.ProvidesIncludes == nil {
						if !in.IsDelim(']') {
							out.ProvidesIncludes = make([]string, 0, 4)
						} else {
							out.ProvidesIncludes = []string{}
						}
					} else {
						out.ProvidesIncludes = (out.ProvidesIncludes)[:0]
					}
					for !in.IsDelim(']') {
						var v8 string
						v8 = string(in.String())
						out.ProvidesIncludes = append(out.ProvidesIncludes, v8)
						in.WantComma()
					}
					in.Delim(']')
				}
			default:
				in.SkipRecursive()
			}
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson42239ddeEncodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex(out *jwriter.Writer, in indexRelease) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"version\":"
		out.RawString(prefix)
		if in.Version == nil {
			out.RawString("null")
		} else {
			out.Raw((*in.Version).MarshalJSON())
		}
	}
	{
		const prefix string = ",\"author\":"
		out.RawString(prefix)
		out.String(string(in.Author))
	}
	{
		const prefix string = ",\"maintainer\":"
		out.RawString(prefix)
		out.String(string(in.Maintainer))
	}
	{
		const prefix string = ",\"sentence\":"
		out.RawString(prefix)
		out.String(string(in.Sentence))
	}
	{
		const prefix string = ",\"paragraph\":"
		out.RawString(prefix)
		out.String(string(in.Paragraph))
	}
	{
		const prefix string = ",\"website\":"
		out.RawString(prefix)
		out.String(string(in.Website))
	}
	{
		const prefix string = ",\"category\":"
		out.RawString(prefix)
		out.String(string(in.Category))
	}
	{
		const prefix string = ",\"architectures\":"
		out.RawString(prefix)
		if in.Architectures == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v9, v10 := range in.Architectures {
				if v9 > 0 {
					out.RawByte(',')
				}
				out.String(string(v10))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"types\":"
		out.RawString(prefix)
		if in.Types == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v11, v12 := range in.Types {
				if v11 > 0 {
					out.RawByte(',')
				}
				out.String(string(v12))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"url\":"
		out.RawString(prefix)
		out.String(string(in.URL))
	}
	{
		const prefix string = ",\"archiveFileName\":"
		out.RawString(prefix)
		out.String(string(in.ArchiveFileName))
	}
	{
		const prefix string = ",\"size\":"
		out.RawString(prefix)
		out.Int64(int64(in.Size))
	}
	{
		const prefix string = ",\"checksum\":"
		out.RawString(prefix)
		out.String(string(in.Checksum))
	}
	if len(in.Dependencies) != 0 {
		const prefix string = ",\"dependencies\":"
		out.RawString(prefix)
		{
			out.RawByte('[')
			for v13, v14 := range in.Dependencies {
				if v13 > 0 {
					out.RawByte(',')
				}
				if v14 == nil {
					out.RawString("null")
				} else {
					(*v14).MarshalEasyJSON(out)
				}
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"license\":"
		out.RawString(prefix)
		out.String(string(in.License))
	}
	{
		const prefix string = ",\"providesIncludes\":"
		out.RawString(prefix)
		if in.ProvidesIncludes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v15, v16 := range in.ProvidesIncludes {
				if v15 > 0 {
					out.RawByte(',')
				}
				out.String(string(v16))
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *indexRelease) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson42239ddeDecodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex(l, v)
}
func easyjson42239ddeDecodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex1(in *jlexer.Lexer, out *indexJSON) {
	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 "libraries":
			if in.IsNull() {
				in.Skip()
				out.Libraries = nil
			} else {
				in.Delim('[')
				if out.Libraries == nil {
					if !in.IsDelim(']') {
						out.Libraries = make([]indexRelease, 0, 0)
					} else {
						out.Libraries = []indexRelease{}
					}
				} else {
					out.Libraries = (out.Libraries)[:0]
				}
				for !in.IsDelim(']') {
					var v17 indexRelease
					(v17).UnmarshalEasyJSON(in)
					out.Libraries = append(out.Libraries, v17)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			switch strings.ToLower(key) {
			case "libraries":
				if in.IsNull() {
					in.Skip()
					out.Libraries = nil
				} else {
					in.Delim('[')
					if out.Libraries == nil {
						if !in.IsDelim(']') {
							out.Libraries = make([]indexRelease, 0, 0)
						} else {
							out.Libraries = []indexRelease{}
						}
					} else {
						out.Libraries = (out.Libraries)[:0]
					}
					for !in.IsDelim(']') {
						var v18 indexRelease
						(v18).UnmarshalEasyJSON(in)
						out.Libraries = append(out.Libraries, v18)
						in.WantComma()
					}
					in.Delim(']')
				}
			default:
				in.SkipRecursive()
			}
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson42239ddeEncodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex1(out *jwriter.Writer, in indexJSON) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"libraries\":"
		out.RawString(prefix[1:])
		if in.Libraries == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v19, v20 := range in.Libraries {
				if v19 > 0 {
					out.RawByte(',')
				}
				(v20).MarshalEasyJSON(out)
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *indexJSON) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson42239ddeDecodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex1(l, v)
}
func easyjson42239ddeDecodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex2(in *jlexer.Lexer, out *indexDependency) {
	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 "version":
			out.Version = string(in.String())
		default:
			switch strings.ToLower(key) {
			case "name":
				out.Name = string(in.String())
			case "version":
				out.Version = string(in.String())
			default:
				in.SkipRecursive()
			}
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson42239ddeEncodeGithubComArduinoArduinoCliArduinoLibrariesLibrariesindex2(out *jwriter.Writer, in indexDependency) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	if in.Version != "" {
		const prefix string = ",\"version\":"
		out.RawString(prefix)
		out.String(string(in.Version))
	}
	out.RawByte('}')
}

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

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

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

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