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

package alarm

import (
	json "encoding/json"
	datetime "git.canopsis.net/canopsis/canopsis-community/community/go-engines-community/lib/canopsis/datetime"
	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 easyjsonD2b7633eDecodeGitCanopsisNetCanopsisCanopsisCommunityCommunityGoEnginesCommunityLibApiAlarm(in *jlexer.Lexer, out *ExportFetchParameters) {
	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 "time_format":
			out.TimeFormat = string(in.String())
		case "filters":
			if in.IsNull() {
				in.Skip()
				out.Filters = nil
			} else {
				in.Delim('[')
				if out.Filters == nil {
					if !in.IsDelim(']') {
						out.Filters = make([]string, 0, 4)
					} else {
						out.Filters = []string{}
					}
				} else {
					out.Filters = (out.Filters)[:0]
				}
				for !in.IsDelim(']') {
					var v1 string
					v1 = string(in.String())
					out.Filters = append(out.Filters, v1)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "search":
			out.Search = string(in.String())
		case "time_field":
			out.TimeField = string(in.String())
		case "tstart":
			if in.IsNull() {
				in.Skip()
				out.StartFrom = nil
			} else {
				if out.StartFrom == nil {
					out.StartFrom = new(datetime.CpsTime)
				}
				if data := in.Raw(); in.Ok() {
					in.AddError((*out.StartFrom).UnmarshalJSON(data))
				}
			}
		case "tstop":
			if in.IsNull() {
				in.Skip()
				out.StartTo = nil
			} else {
				if out.StartTo == nil {
					out.StartTo = new(datetime.CpsTime)
				}
				if data := in.Raw(); in.Ok() {
					in.AddError((*out.StartTo).UnmarshalJSON(data))
				}
			}
		case "opened":
			if in.IsNull() {
				in.Skip()
				out.Opened = nil
			} else {
				if out.Opened == nil {
					out.Opened = new(bool)
				}
				*out.Opened = bool(in.Bool())
			}
		case "correlation":
			out.OnlyParents = bool(in.Bool())
		case "category":
			out.Category = 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 v2 string
					v2 = string(in.String())
					out.Tags = append(out.Tags, v2)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "alarm_pattern":
			out.AlarmPattern = string(in.String())
		case "entity_pattern":
			out.EntityPattern = string(in.String())
		case "pbehavior_pattern":
			out.PbehaviorPattern = string(in.String())
		case "instruction_filter_type":
			if in.IsNull() {
				in.Skip()
				out.InstructionFilterType = nil
			} else {
				if out.InstructionFilterType == nil {
					out.InstructionFilterType = new(int)
				}
				*out.InstructionFilterType = int(in.Int())
			}
		case "instruction_type":
			if in.IsNull() {
				in.Skip()
				out.InstructionType = nil
			} else {
				if out.InstructionType == nil {
					out.InstructionType = new(int)
				}
				*out.InstructionType = int(in.Int())
			}
		case "instruction_statuses":
			if in.IsNull() {
				in.Skip()
				out.InstructionStatuses = nil
			} else {
				in.Delim('[')
				if out.InstructionStatuses == nil {
					if !in.IsDelim(']') {
						out.InstructionStatuses = make([]int, 0, 8)
					} else {
						out.InstructionStatuses = []int{}
					}
				} else {
					out.InstructionStatuses = (out.InstructionStatuses)[:0]
				}
				for !in.IsDelim(']') {
					var v3 int
					v3 = int(in.Int())
					out.InstructionStatuses = append(out.InstructionStatuses, v3)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "instruction_ids":
			if in.IsNull() {
				in.Skip()
				out.InstructionIDs = nil
			} else {
				in.Delim('[')
				if out.InstructionIDs == nil {
					if !in.IsDelim(']') {
						out.InstructionIDs = make([]string, 0, 4)
					} else {
						out.InstructionIDs = []string{}
					}
				} else {
					out.InstructionIDs = (out.InstructionIDs)[:0]
				}
				for !in.IsDelim(']') {
					var v4 string
					v4 = string(in.String())
					out.InstructionIDs = append(out.InstructionIDs, v4)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "only_bookmarks":
			out.OnlyBookmarks = bool(in.Bool())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonD2b7633eEncodeGitCanopsisNetCanopsisCanopsisCommunityCommunityGoEnginesCommunityLibApiAlarm(out *jwriter.Writer, in ExportFetchParameters) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"time_format\":"
		out.RawString(prefix[1:])
		out.String(string(in.TimeFormat))
	}
	{
		const prefix string = ",\"filters\":"
		out.RawString(prefix)
		if in.Filters == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v5, v6 := range in.Filters {
				if v5 > 0 {
					out.RawByte(',')
				}
				out.String(string(v6))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"search\":"
		out.RawString(prefix)
		out.String(string(in.Search))
	}
	{
		const prefix string = ",\"time_field\":"
		out.RawString(prefix)
		out.String(string(in.TimeField))
	}
	{
		const prefix string = ",\"tstart\":"
		out.RawString(prefix)
		if in.StartFrom == nil {
			out.RawString("null")
		} else {
			out.Raw((*in.StartFrom).MarshalJSON())
		}
	}
	{
		const prefix string = ",\"tstop\":"
		out.RawString(prefix)
		if in.StartTo == nil {
			out.RawString("null")
		} else {
			out.Raw((*in.StartTo).MarshalJSON())
		}
	}
	{
		const prefix string = ",\"opened\":"
		out.RawString(prefix)
		if in.Opened == nil {
			out.RawString("null")
		} else {
			out.Bool(bool(*in.Opened))
		}
	}
	{
		const prefix string = ",\"correlation\":"
		out.RawString(prefix)
		out.Bool(bool(in.OnlyParents))
	}
	{
		const prefix string = ",\"category\":"
		out.RawString(prefix)
		out.String(string(in.Category))
	}
	{
		const prefix string = ",\"tags\":"
		out.RawString(prefix)
		if in.Tags == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v7, v8 := range in.Tags {
				if v7 > 0 {
					out.RawByte(',')
				}
				out.String(string(v8))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"alarm_pattern\":"
		out.RawString(prefix)
		out.String(string(in.AlarmPattern))
	}
	{
		const prefix string = ",\"entity_pattern\":"
		out.RawString(prefix)
		out.String(string(in.EntityPattern))
	}
	{
		const prefix string = ",\"pbehavior_pattern\":"
		out.RawString(prefix)
		out.String(string(in.PbehaviorPattern))
	}
	{
		const prefix string = ",\"instruction_filter_type\":"
		out.RawString(prefix)
		if in.InstructionFilterType == nil {
			out.RawString("null")
		} else {
			out.Int(int(*in.InstructionFilterType))
		}
	}
	{
		const prefix string = ",\"instruction_type\":"
		out.RawString(prefix)
		if in.InstructionType == nil {
			out.RawString("null")
		} else {
			out.Int(int(*in.InstructionType))
		}
	}
	{
		const prefix string = ",\"instruction_statuses\":"
		out.RawString(prefix)
		if in.InstructionStatuses == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v9, v10 := range in.InstructionStatuses {
				if v9 > 0 {
					out.RawByte(',')
				}
				out.Int(int(v10))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"instruction_ids\":"
		out.RawString(prefix)
		if in.InstructionIDs == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
			out.RawString("null")
		} else {
			out.RawByte('[')
			for v11, v12 := range in.InstructionIDs {
				if v11 > 0 {
					out.RawByte(',')
				}
				out.String(string(v12))
			}
			out.RawByte(']')
		}
	}
	{
		const prefix string = ",\"only_bookmarks\":"
		out.RawString(prefix)
		out.Bool(bool(in.OnlyBookmarks))
	}
	out.RawByte('}')
}

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

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