// Copyright 2021 iLogtail Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// TEMPORARY AUTOGENERATED FILE: easyjson stub code to make the package
// compilable during generation.

package stdout

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 easyjsonAd89f942DecodeLogtailpluginExperimentsJson(in *jlexer.Lexer, out *DockerJSONLog) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeString()
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "log":
			out.LogContent = string(in.String())
		case "stream":
			out.StreamType = string(in.String())
		case "time":
			out.Time = string(in.String())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonAd89f942EncodeLogtailpluginExperimentsJson(out *jwriter.Writer, in DockerJSONLog) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"log\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.String(string(in.LogContent))
	}
	{
		const prefix string = ",\"stream\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.String(string(in.StreamType))
	}
	{
		const prefix string = ",\"time\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.String(string(in.Time))
	}
	out.RawByte('}')
}

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

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

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

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