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

package filesystem

import (
	json "encoding/json"
	cdp "github.com/chromedp/cdproto/cdp"
	storage "github.com/chromedp/cdproto/storage"
	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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem(in *jlexer.Lexer, out *GetDirectoryReturns) {
	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 "directory":
			if in.IsNull() {
				in.Skip()
				out.Directory = nil
			} else {
				if out.Directory == nil {
					out.Directory = new(Directory)
				}
				(*out.Directory).UnmarshalEasyJSON(in)
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFilesystem(out *jwriter.Writer, in GetDirectoryReturns) {
	out.RawByte('{')
	first := true
	_ = first
	if in.Directory != nil {
		const prefix string = ",\"directory\":"
		first = false
		out.RawString(prefix[1:])
		(*in.Directory).MarshalEasyJSON(out)
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDirectoryReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem1(in *jlexer.Lexer, out *GetDirectoryParams) {
	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 "bucketFileSystemLocator":
			if in.IsNull() {
				in.Skip()
				out.BucketFileSystemLocator = nil
			} else {
				if out.BucketFileSystemLocator == nil {
					out.BucketFileSystemLocator = new(BucketFileSystemLocator)
				}
				(*out.BucketFileSystemLocator).UnmarshalEasyJSON(in)
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFilesystem1(out *jwriter.Writer, in GetDirectoryParams) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"bucketFileSystemLocator\":"
		out.RawString(prefix[1:])
		if in.BucketFileSystemLocator == nil {
			out.RawString("null")
		} else {
			(*in.BucketFileSystemLocator).MarshalEasyJSON(out)
		}
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDirectoryParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem2(in *jlexer.Lexer, out *File) {
	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 "lastModified":
			if in.IsNull() {
				in.Skip()
				out.LastModified = nil
			} else {
				if out.LastModified == nil {
					out.LastModified = new(cdp.TimeSinceEpoch)
				}
				(*out.LastModified).UnmarshalEasyJSON(in)
			}
		case "size":
			out.Size = float64(in.Float64())
		case "type":
			out.Type = string(in.String())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFilesystem2(out *jwriter.Writer, in File) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"lastModified\":"
		out.RawString(prefix)
		if in.LastModified == nil {
			out.RawString("null")
		} else {
			(*in.LastModified).MarshalEasyJSON(out)
		}
	}
	{
		const prefix string = ",\"size\":"
		out.RawString(prefix)
		out.Float64(float64(in.Size))
	}
	{
		const prefix string = ",\"type\":"
		out.RawString(prefix)
		out.String(string(in.Type))
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *File) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem3(in *jlexer.Lexer, out *Directory) {
	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 "nestedDirectories":
			if in.IsNull() {
				in.Skip()
				out.NestedDirectories = nil
			} else {
				in.Delim('[')
				if out.NestedDirectories == nil {
					if !in.IsDelim(']') {
						out.NestedDirectories = make([]string, 0, 4)
					} else {
						out.NestedDirectories = []string{}
					}
				} else {
					out.NestedDirectories = (out.NestedDirectories)[:0]
				}
				for !in.IsDelim(']') {
					var v1 string
					v1 = string(in.String())
					out.NestedDirectories = append(out.NestedDirectories, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "nestedFiles":
			if in.IsNull() {
				in.Skip()
				out.NestedFiles = nil
			} else {
				in.Delim('[')
				if out.NestedFiles == nil {
					if !in.IsDelim(']') {
						out.NestedFiles = make([]*File, 0, 8)
					} else {
						out.NestedFiles = []*File{}
					}
				} else {
					out.NestedFiles = (out.NestedFiles)[:0]
				}
				for !in.IsDelim(']') {
					var v2 *File
					if in.IsNull() {
						in.Skip()
						v2 = nil
					} else {
						if v2 == nil {
							v2 = new(File)
						}
						(*v2).UnmarshalEasyJSON(in)
					}
					out.NestedFiles = append(out.NestedFiles, v2)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFilesystem3(out *jwriter.Writer, in Directory) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"nestedDirectories\":"
		out.RawString(prefix)
		if in.NestedDirectories == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v3, v4 := range in.NestedDirectories {
				if v3 > 0 {
					out.RawByte(',')
				}
				out.String(string(v4))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"nestedFiles\":"
		out.RawString(prefix)
		if in.NestedFiles == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v5, v6 := range in.NestedFiles {
				if v5 > 0 {
					out.RawByte(',')
				}
				if v6 == nil {
					out.RawString("null")
				} else {
					(*v6).MarshalEasyJSON(out)
				}
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Directory) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFilesystem4(in *jlexer.Lexer, out *BucketFileSystemLocator) {
	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 "storageKey":
			out.StorageKey = storage.SerializedStorageKey(in.String())
		case "bucketName":
			out.BucketName = string(in.String())
		case "pathComponents":
			if in.IsNull() {
				in.Skip()
				out.PathComponents = nil
			} else {
				in.Delim('[')
				if out.PathComponents == nil {
					if !in.IsDelim(']') {
						out.PathComponents = make([]string, 0, 4)
					} else {
						out.PathComponents = []string{}
					}
				} else {
					out.PathComponents = (out.PathComponents)[:0]
				}
				for !in.IsDelim(']') {
					var v7 string
					v7 = string(in.String())
					out.PathComponents = append(out.PathComponents, v7)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFilesystem4(out *jwriter.Writer, in BucketFileSystemLocator) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"storageKey\":"
		out.RawString(prefix[1:])
		out.String(string(in.StorageKey))
	}
	if in.BucketName != "" {
		const prefix string = ",\"bucketName\":"
		out.RawString(prefix)
		out.String(string(in.BucketName))
	}
	{
		const prefix string = ",\"pathComponents\":"
		out.RawString(prefix)
		if in.PathComponents == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v8, v9 := range in.PathComponents {
				if v8 > 0 {
					out.RawByte(',')
				}
				out.String(string(v9))
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

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