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

package esi

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 easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetWarsWarIdOkList) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		in.Skip()
		*out = nil
	} else {
		in.Delim('[')
		if *out == nil {
			if !in.IsDelim(']') {
				*out = make(GetWarsWarIdOkList, 0, 0)
			} else {
				*out = GetWarsWarIdOkList{}
			}
		} else {
			*out = (*out)[:0]
		}
		for !in.IsDelim(']') {
			var v1 GetWarsWarIdOk
			(v1).UnmarshalEasyJSON(in)
			*out = append(*out, v1)
			in.WantComma()
		}
		in.Delim(']')
	}
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetWarsWarIdOkList) {
	if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
		out.RawString("null")
	} else {
		out.RawByte('[')
		for v2, v3 := range in {
			if v2 > 0 {
				out.RawByte(',')
			}
			(v3).MarshalEasyJSON(out)
		}
		out.RawByte(']')
	}
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetWarsWarIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi(l, v)
}
func easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetWarsWarIdOk) {
	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 "aggressor":
			easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi2(in, &out.Aggressor)
		case "allies":
			if in.IsNull() {
				in.Skip()
				out.Allies = nil
			} else {
				in.Delim('[')
				if out.Allies == nil {
					if !in.IsDelim(']') {
						out.Allies = make([]GetWarsWarIdAlly, 0, 8)
					} else {
						out.Allies = []GetWarsWarIdAlly{}
					}
				} else {
					out.Allies = (out.Allies)[:0]
				}
				for !in.IsDelim(']') {
					var v4 GetWarsWarIdAlly
					easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi3(in, &v4)
					out.Allies = append(out.Allies, v4)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "declared":
			if data := in.Raw(); in.Ok() {
				in.AddError((out.Declared).UnmarshalJSON(data))
			}
		case "defender":
			easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi4(in, &out.Defender)
		case "finished":
			if data := in.Raw(); in.Ok() {
				in.AddError((out.Finished).UnmarshalJSON(data))
			}
		case "id":
			out.Id = int32(in.Int32())
		case "mutual":
			out.Mutual = bool(in.Bool())
		case "open_for_allies":
			out.OpenForAllies = bool(in.Bool())
		case "retracted":
			if data := in.Raw(); in.Ok() {
				in.AddError((out.Retracted).UnmarshalJSON(data))
			}
		case "started":
			if data := in.Raw(); in.Ok() {
				in.AddError((out.Started).UnmarshalJSON(data))
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetWarsWarIdOk) {
	out.RawByte('{')
	first := true
	_ = first
	if true {
		const prefix string = ",\"aggressor\":"
		first = false
		out.RawString(prefix[1:])
		easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi2(out, in.Aggressor)
	}
	if len(in.Allies) != 0 {
		const prefix string = ",\"allies\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		{
			out.RawByte('[')
			for v5, v6 := range in.Allies {
				if v5 > 0 {
					out.RawByte(',')
				}
				easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi3(out, v6)
			}
			out.RawByte(']')
		}
	}
	if true {
		const prefix string = ",\"declared\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Raw((in.Declared).MarshalJSON())
	}
	if true {
		const prefix string = ",\"defender\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi4(out, in.Defender)
	}
	if true {
		const prefix string = ",\"finished\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Raw((in.Finished).MarshalJSON())
	}
	if in.Id != 0 {
		const prefix string = ",\"id\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int32(int32(in.Id))
	}
	if in.Mutual {
		const prefix string = ",\"mutual\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Bool(bool(in.Mutual))
	}
	if in.OpenForAllies {
		const prefix string = ",\"open_for_allies\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Bool(bool(in.OpenForAllies))
	}
	if true {
		const prefix string = ",\"retracted\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Raw((in.Retracted).MarshalJSON())
	}
	if true {
		const prefix string = ",\"started\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Raw((in.Started).MarshalJSON())
	}
	out.RawByte('}')
}

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

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetWarsWarIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi1(l, v)
}
func easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi4(in *jlexer.Lexer, out *GetWarsWarIdDefender) {
	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 "alliance_id":
			out.AllianceId = int32(in.Int32())
		case "corporation_id":
			out.CorporationId = int32(in.Int32())
		case "isk_destroyed":
			out.IskDestroyed = float32(in.Float32())
		case "ships_killed":
			out.ShipsKilled = int32(in.Int32())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi4(out *jwriter.Writer, in GetWarsWarIdDefender) {
	out.RawByte('{')
	first := true
	_ = first
	if in.AllianceId != 0 {
		const prefix string = ",\"alliance_id\":"
		first = false
		out.RawString(prefix[1:])
		out.Int32(int32(in.AllianceId))
	}
	if in.CorporationId != 0 {
		const prefix string = ",\"corporation_id\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int32(int32(in.CorporationId))
	}
	if in.IskDestroyed != 0 {
		const prefix string = ",\"isk_destroyed\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Float32(float32(in.IskDestroyed))
	}
	if in.ShipsKilled != 0 {
		const prefix string = ",\"ships_killed\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int32(int32(in.ShipsKilled))
	}
	out.RawByte('}')
}
func easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi3(in *jlexer.Lexer, out *GetWarsWarIdAlly) {
	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 "alliance_id":
			out.AllianceId = int32(in.Int32())
		case "corporation_id":
			out.CorporationId = int32(in.Int32())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi3(out *jwriter.Writer, in GetWarsWarIdAlly) {
	out.RawByte('{')
	first := true
	_ = first
	if in.AllianceId != 0 {
		const prefix string = ",\"alliance_id\":"
		first = false
		out.RawString(prefix[1:])
		out.Int32(int32(in.AllianceId))
	}
	if in.CorporationId != 0 {
		const prefix string = ",\"corporation_id\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int32(int32(in.CorporationId))
	}
	out.RawByte('}')
}
func easyjsonF6dfc9daDecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetWarsWarIdAggressor) {
	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 "alliance_id":
			out.AllianceId = int32(in.Int32())
		case "corporation_id":
			out.CorporationId = int32(in.Int32())
		case "isk_destroyed":
			out.IskDestroyed = float32(in.Float32())
		case "ships_killed":
			out.ShipsKilled = int32(in.Int32())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonF6dfc9daEncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetWarsWarIdAggressor) {
	out.RawByte('{')
	first := true
	_ = first
	if in.AllianceId != 0 {
		const prefix string = ",\"alliance_id\":"
		first = false
		out.RawString(prefix[1:])
		out.Int32(int32(in.AllianceId))
	}
	if in.CorporationId != 0 {
		const prefix string = ",\"corporation_id\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int32(int32(in.CorporationId))
	}
	if in.IskDestroyed != 0 {
		const prefix string = ",\"isk_destroyed\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Float32(float32(in.IskDestroyed))
	}
	if in.ShipsKilled != 0 {
		const prefix string = ",\"ships_killed\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		out.Int32(int32(in.ShipsKilled))
	}
	out.RawByte('}')
}
