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

package router

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 easyjsonF301f710DecodeGithubComDidiNightingaleV5SrcServerRouter(in *jlexer.Lexer, out *TimeSeries) {
	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 "series":
			if in.IsNull() {
				in.Skip()
				out.Series = nil
			} else {
				in.Delim('[')
				if out.Series == nil {
					if !in.IsDelim(']') {
						out.Series = make([]*DatadogMetric, 0, 8)
					} else {
						out.Series = []*DatadogMetric{}
					}
				} else {
					out.Series = (out.Series)[:0]
				}
				for !in.IsDelim(']') {
					var v1 *DatadogMetric
					if in.IsNull() {
						in.Skip()
						v1 = nil
					} else {
						if v1 == nil {
							v1 = new(DatadogMetric)
						}
						(*v1).UnmarshalEasyJSON(in)
					}
					out.Series = append(out.Series, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF301f710EncodeGithubComDidiNightingaleV5SrcServerRouter(out *jwriter.Writer, in TimeSeries) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"series\":"
		out.RawString(prefix[1:])
		if in.Series == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v2, v3 := range in.Series {
				if v2 > 0 {
					out.RawByte(',')
				}
				if v3 == nil {
					out.RawString("null")
				} else {
					(*v3).MarshalEasyJSON(out)
				}
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *TimeSeries) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonF301f710DecodeGithubComDidiNightingaleV5SrcServerRouter(l, v)
}
func easyjsonF301f710DecodeGithubComDidiNightingaleV5SrcServerRouter1(in *jlexer.Lexer, out *DatadogPoint) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		in.Skip()
	} else {
		in.Delim('[')
		v4 := 0
		for !in.IsDelim(']') {
			if v4 < 2 {
				(*out)[v4] = float64(in.Float64())
				v4++
			} else {
				in.SkipRecursive()
			}
			in.WantComma()
		}
		in.Delim(']')
	}
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF301f710EncodeGithubComDidiNightingaleV5SrcServerRouter1(out *jwriter.Writer, in DatadogPoint) {
	out.RawByte('[')
	for v5 := range in {
		if v5 > 0 {
			out.RawByte(',')
		}
		out.Float64(float64((in)[v5]))
	}
	out.RawByte(']')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DatadogPoint) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonF301f710DecodeGithubComDidiNightingaleV5SrcServerRouter1(l, v)
}
func easyjsonF301f710DecodeGithubComDidiNightingaleV5SrcServerRouter2(in *jlexer.Lexer, out *DatadogMetric) {
	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 "metric":
			out.Metric = string(in.String())
		case "points":
			if in.IsNull() {
				in.Skip()
				out.Points = nil
			} else {
				in.Delim('[')
				if out.Points == nil {
					if !in.IsDelim(']') {
						out.Points = make([]DatadogPoint, 0, 4)
					} else {
						out.Points = []DatadogPoint{}
					}
				} else {
					out.Points = (out.Points)[:0]
				}
				for !in.IsDelim(']') {
					var v6 DatadogPoint
					(v6).UnmarshalEasyJSON(in)
					out.Points = append(out.Points, v6)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "host":
			out.Host = string(in.String())
		case "tags":
			if in.IsNull() {
				in.Skip()
				out.Tags = nil
			} else {
				in.Delim('[')
				if out.Tags == nil {
					if !in.IsDelim(']') {
						out.Tags = make([]string, 0, 4)
					} else {
						out.Tags = []string{}
					}
				} else {
					out.Tags = (out.Tags)[:0]
				}
				for !in.IsDelim(']') {
					var v7 string
					v7 = string(in.String())
					out.Tags = append(out.Tags, v7)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF301f710EncodeGithubComDidiNightingaleV5SrcServerRouter2(out *jwriter.Writer, in DatadogMetric) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"metric\":"
		out.RawString(prefix[1:])
		out.String(string(in.Metric))
	}
	{
		const prefix string = ",\"points\":"
		out.RawString(prefix)
		if in.Points == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v8, v9 := range in.Points {
				if v8 > 0 {
					out.RawByte(',')
				}
				(v9).MarshalEasyJSON(out)
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"host\":"
		out.RawString(prefix)
		out.String(string(in.Host))
	}
	if len(in.Tags) != 0 {
		const prefix string = ",\"tags\":"
		out.RawString(prefix)
		{
			out.RawByte('[')
			for v10, v11 := range in.Tags {
				if v10 > 0 {
					out.RawByte(',')
				}
				out.String(string(v11))
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

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