// 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 easyjsonB983e026DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdRolesOkList) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		in.Skip()
		*out = nil
	} else {
		in.Delim('[')
		if *out == nil {
			if !in.IsDelim(']') {
				*out = make(GetCharactersCharacterIdRolesOkList, 0, 0)
			} else {
				*out = GetCharactersCharacterIdRolesOkList{}
			}
		} else {
			*out = (*out)[:0]
		}
		for !in.IsDelim(']') {
			var v1 GetCharactersCharacterIdRolesOk
			(v1).UnmarshalEasyJSON(in)
			*out = append(*out, v1)
			in.WantComma()
		}
		in.Delim(']')
	}
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonB983e026EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdRolesOkList) {
	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 GetCharactersCharacterIdRolesOkList) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB983e026EncodeGithubComAntihaxGoesiEsi(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

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

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

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetCharactersCharacterIdRolesOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonB983e026DecodeGithubComAntihaxGoesiEsi(l, v)
}
func easyjsonB983e026DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdRolesOk) {
	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 "roles":
			if in.IsNull() {
				in.Skip()
				out.Roles = nil
			} else {
				in.Delim('[')
				if out.Roles == nil {
					if !in.IsDelim(']') {
						out.Roles = make([]string, 0, 4)
					} else {
						out.Roles = []string{}
					}
				} else {
					out.Roles = (out.Roles)[:0]
				}
				for !in.IsDelim(']') {
					var v4 string
					v4 = string(in.String())
					out.Roles = append(out.Roles, v4)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "roles_at_base":
			if in.IsNull() {
				in.Skip()
				out.RolesAtBase = nil
			} else {
				in.Delim('[')
				if out.RolesAtBase == nil {
					if !in.IsDelim(']') {
						out.RolesAtBase = make([]string, 0, 4)
					} else {
						out.RolesAtBase = []string{}
					}
				} else {
					out.RolesAtBase = (out.RolesAtBase)[:0]
				}
				for !in.IsDelim(']') {
					var v5 string
					v5 = string(in.String())
					out.RolesAtBase = append(out.RolesAtBase, v5)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "roles_at_hq":
			if in.IsNull() {
				in.Skip()
				out.RolesAtHq = nil
			} else {
				in.Delim('[')
				if out.RolesAtHq == nil {
					if !in.IsDelim(']') {
						out.RolesAtHq = make([]string, 0, 4)
					} else {
						out.RolesAtHq = []string{}
					}
				} else {
					out.RolesAtHq = (out.RolesAtHq)[:0]
				}
				for !in.IsDelim(']') {
					var v6 string
					v6 = string(in.String())
					out.RolesAtHq = append(out.RolesAtHq, v6)
					in.WantComma()
				}
				in.Delim(']')
			}
		case "roles_at_other":
			if in.IsNull() {
				in.Skip()
				out.RolesAtOther = nil
			} else {
				in.Delim('[')
				if out.RolesAtOther == nil {
					if !in.IsDelim(']') {
						out.RolesAtOther = make([]string, 0, 4)
					} else {
						out.RolesAtOther = []string{}
					}
				} else {
					out.RolesAtOther = (out.RolesAtOther)[:0]
				}
				for !in.IsDelim(']') {
					var v7 string
					v7 = string(in.String())
					out.RolesAtOther = append(out.RolesAtOther, v7)
					in.WantComma()
				}
				in.Delim(']')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonB983e026EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdRolesOk) {
	out.RawByte('{')
	first := true
	_ = first
	if len(in.Roles) != 0 {
		const prefix string = ",\"roles\":"
		first = false
		out.RawString(prefix[1:])
		{
			out.RawByte('[')
			for v8, v9 := range in.Roles {
				if v8 > 0 {
					out.RawByte(',')
				}
				out.String(string(v9))
			}
			out.RawByte(']')
		}
	}
	if len(in.RolesAtBase) != 0 {
		const prefix string = ",\"roles_at_base\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		{
			out.RawByte('[')
			for v10, v11 := range in.RolesAtBase {
				if v10 > 0 {
					out.RawByte(',')
				}
				out.String(string(v11))
			}
			out.RawByte(']')
		}
	}
	if len(in.RolesAtHq) != 0 {
		const prefix string = ",\"roles_at_hq\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		{
			out.RawByte('[')
			for v12, v13 := range in.RolesAtHq {
				if v12 > 0 {
					out.RawByte(',')
				}
				out.String(string(v13))
			}
			out.RawByte(']')
		}
	}
	if len(in.RolesAtOther) != 0 {
		const prefix string = ",\"roles_at_other\":"
		if first {
			first = false
			out.RawString(prefix[1:])
		} else {
			out.RawString(prefix)
		}
		{
			out.RawByte('[')
			for v14, v15 := range in.RolesAtOther {
				if v14 > 0 {
					out.RawByte(',')
				}
				out.String(string(v15))
			}
			out.RawByte(']')
		}
	}
	out.RawByte('}')
}

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

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

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

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