package zapjournal

import (
	
	
	
	
	

	
)

type jsonEncoder struct {
	bufp *[]byte
	jsonState
}

type jsonState struct {
	depth int
	prev  bool
}

func ( *jsonEncoder) () []byte {
	return *.bufp
}

func ( *jsonEncoder) ( []byte) {
	*.bufp = 
}

func ( *jsonEncoder) () jsonState {
	 := .jsonState
	.jsonState = jsonState{}
	return 
}

func ( *jsonEncoder) ( string) {
	.appendSep()
	.appendQuotedString()
	.appendColon()
}

func ( *jsonEncoder) ( string) {
	.setBuf(strconv.AppendQuote(.buf(), ))
}

func ( *jsonEncoder) ( int64) {
	.appendQuote()
	.setBuf(strconv.AppendInt(.buf(), , 10))
	.appendQuote()
}

func ( *jsonEncoder) ( uint64) {
	.appendQuote()
	.setBuf(strconv.AppendUint(.buf(), , 10))
	.appendQuote()
}

func ( *jsonEncoder) ( uintptr) {
	.appendQuote()
	.setBuf(append(.buf(), "0x"...))
	.setBuf(strconv.AppendUint(.buf(), uint64(), 16))
	.appendQuote()
}

func ( *jsonEncoder) ( float64,  int) {
	.appendQuote()
	.setBuf(strconv.AppendFloat(.buf(), , 'g', -1, ))
	.appendQuote()
}

func ( *jsonEncoder) ( complex128,  int) {
	.appendQuote()
	.setBuf(strconvAppendComplex(.buf(), , 'g', -1, ))
	.appendQuote()
}

func ( *jsonEncoder) ( any) error {
	 := bytes.NewBuffer(.buf())
	 := json.NewEncoder()
	.SetEscapeHTML(false)
	 := .Encode()
	.setBuf(.Bytes())
	return 
}

func ( *jsonEncoder) ( byte) {
	.setBuf(append(.buf(), ))
}

func ( *jsonEncoder) () {
	.appendByte(':')
}

func ( *jsonEncoder) () {
	.appendByte('"')
}

func ( *jsonEncoder) () {
	.appendByte('[')
}

func ( *jsonEncoder) () {
	.appendByte(']')
}

func ( *jsonEncoder) () {
	.appendByte('{')
}

func ( *jsonEncoder) () {
	.appendByte('}')
}

func ( *jsonEncoder) () {
	if !.prev {
		.prev = true
		return
	}
	.setBuf(append(.buf(), ','))
}

func ( *jsonEncoder) () {
	for ; .depth > 0; .depth-- {
		.appendCloseObject()
	}
	.prev = false
}

//
// Binary
//

func ( *jsonEncoder) ( string,  []byte) {
	.appendSep()
	.encodeBinary()
}

func ( *jsonEncoder) ( []byte) {
	.setBuf(base64Append(base64.StdEncoding, .buf(), ))
}

//
// Duration
//

func ( *jsonEncoder) ( string,  time.Duration) {
	.appendKey()
	.encodeDuration()
}

func ( *jsonEncoder) ( time.Duration) {
	.appendSep()
	.encodeDuration()
}

func ( *jsonEncoder) ( time.Duration) {
	.appendQuote()
	.setBuf(append(.buf(), .String()...))
	.appendQuote()
}

//
// Time
//

func ( *jsonEncoder) ( string,  time.Time) {
	.appendKey()
	.encodeTime()
}

func ( *jsonEncoder) ( time.Time) {
	.appendSep()
	.encodeTime()
}

func ( *jsonEncoder) ( time.Time) {
	.appendQuote()
	.setBuf(.AppendFormat(.buf(), time.RFC3339Nano))
	.appendQuote()
}

//
// Bool
//

func ( *jsonEncoder) ( string,  bool) {
	.appendKey()
	.encodeBool()
}

func ( *jsonEncoder) ( bool) {
	.appendSep()
	.encodeBool()
}

func ( *jsonEncoder) ( bool) {
	.setBuf(strconv.AppendBool(.buf(), ))
}

//
// ByteString
//

func ( *jsonEncoder) ( string,  []byte) {
	.appendKey()
	.encodeByteString()
}

func ( *jsonEncoder) ( []byte) {
	.appendSep()
	.encodeByteString()
}

func ( *jsonEncoder) ( []byte) {
	.appendQuotedString(string())
}

//
// String
//

func ( *jsonEncoder) (,  string) {
	.appendKey()
	.encodeString()
}

func ( *jsonEncoder) ( string) {
	.appendSep()
	.encodeString()
}

func ( *jsonEncoder) ( string) {
	.appendQuotedString()
}

// Complex128

func ( *jsonEncoder) ( string,  complex128) {
	.appendKey()
	.encodeComplex128()
}

func ( *jsonEncoder) ( complex128) {
	.appendSep()
	.encodeComplex128()
}

func ( *jsonEncoder) ( complex128) {
	.appendComplex(, 128)
}

//
// Complex64
//

func ( *jsonEncoder) ( string,  complex64) {
	.appendKey()
	.encodeComplex64()
}

func ( *jsonEncoder) ( complex64) {
	.appendSep()
	.encodeComplex64()
}

func ( *jsonEncoder) ( complex64) {
	.appendComplex(complex128(), 64)
}

//
// Float64
//

func ( *jsonEncoder) ( string,  float64) {
	.appendKey()
	.encodeFloat64()
}

func ( *jsonEncoder) ( float64) {
	.appendSep()
	.encodeFloat64()
}

func ( *jsonEncoder) ( float64) {
	.appendFloat(, 64)
}

//
// Float32
//

func ( *jsonEncoder) ( string,  float32) {
	.appendKey()
	.encodeFloat32()
}

func ( *jsonEncoder) ( float32) {
	.appendSep()
	.encodeFloat32()
}

func ( *jsonEncoder) ( float32) {
	.appendFloat(float64(), 32)
}

//
// Int
//

func ( *jsonEncoder) ( string,  int) {
	.appendKey()
	.encodeInt()
}

func ( *jsonEncoder) ( int) {
	.appendSep()
	.encodeInt()
}

func ( *jsonEncoder) ( int) {
	.appendInt(int64())
}

//
// Int64
//

func ( *jsonEncoder) ( string,  int64) {
	.appendKey()
	.encodeInt64()
}

func ( *jsonEncoder) ( int64) {
	.appendSep()
	.encodeInt64()
}

func ( *jsonEncoder) ( int64) {
	.appendInt()
}

//
// Int32
//

func ( *jsonEncoder) ( string,  int32) {
	.appendKey()
	.encodeInt32()
}

func ( *jsonEncoder) ( int32) {
	.appendSep()
	.encodeInt32()
}

func ( *jsonEncoder) ( int32) {
	.appendInt(int64())
}

//
// Int16
//

func ( *jsonEncoder) ( string,  int16) {
	.appendKey()
	.encodeInt16()
}

func ( *jsonEncoder) ( int16) {
	.appendSep()
	.encodeInt16()
}

func ( *jsonEncoder) ( int16) {
	.appendInt(int64())
}

//
// Int8
//

func ( *jsonEncoder) ( string,  int8) {
	.appendKey()
	.encodeInt8()
}

func ( *jsonEncoder) ( int8) {
	.appendSep()
	.encodeInt8()
}

func ( *jsonEncoder) ( int8) {
	.appendInt(int64())
}

//
// Uint
//

func ( *jsonEncoder) ( string,  uint) {
	.appendKey()
	.encodeUint()
}

func ( *jsonEncoder) ( uint) {
	.appendSep()
	.encodeUint()
}

func ( *jsonEncoder) ( uint) {
	.appendUint(uint64())
}

//
// Uint64
//

func ( *jsonEncoder) ( string,  uint64) {
	.appendKey()
	.encodeUint64()
}

func ( *jsonEncoder) ( uint64) {
	.appendSep()
	.encodeUint64()
}

func ( *jsonEncoder) ( uint64) {
	.appendUint()
}

//
// Uint32
//

func ( *jsonEncoder) ( string,  uint32) {
	.appendKey()
	.encodeUint32()
}

func ( *jsonEncoder) ( uint32) {
	.appendSep()
	.encodeUint32()
}

func ( *jsonEncoder) ( uint32) {
	.appendUint(uint64())
}

//
// Uint16
//

func ( *jsonEncoder) ( string,  uint16) {
	.appendKey()
	.encodeUint16()
}

func ( *jsonEncoder) ( uint16) {
	.appendSep()
	.encodeUint16()
}

func ( *jsonEncoder) ( uint16) {
	.appendUint(uint64())
}

//
// Uint8
//

func ( *jsonEncoder) ( string,  uint8) {
	.appendKey()
	.encodeUint8()
}

func ( *jsonEncoder) ( uint8) {
	.appendSep()
	.encodeUint8()
}

func ( *jsonEncoder) ( uint8) {
	.appendUint(uint64())
}

//
// Uintptr
//

func ( *jsonEncoder) ( string,  uintptr) {
	.appendKey()
	.encodeUintptr()
}

func ( *jsonEncoder) ( uintptr) {
	.appendSep()
	.encodeUintptr()
}

func ( *jsonEncoder) ( uintptr) {
	.appendUintptr()
}

//
// Reflected
//

func ( *jsonEncoder) ( string,  any) error {
	.appendKey()
	return .encodeReflected()
}

func ( *jsonEncoder) ( any) error {
	.appendSep()
	return .encodeReflected()
}

func ( *jsonEncoder) ( any) error {
	return .appendMarshalJSON()
}

//
// Array
//

func ( *jsonEncoder) ( string,  zapcore.ArrayMarshaler) error {
	.appendKey()
	return .encodeArray()
}

func ( *jsonEncoder) ( zapcore.ArrayMarshaler) error {
	.appendSep()
	return .encodeArray()
}

func ( *jsonEncoder) ( zapcore.ArrayMarshaler) error {
	.appendOpenArray()
	 := .nested()
	 := .MarshalLogArray()
	.complete()
	.jsonState = 
	.appendCloseArray()
	return 
}

//
// Object
//

func ( *jsonEncoder) ( string,  zapcore.ObjectMarshaler) error {
	.appendKey()
	return .encodeObject()
}

func ( *jsonEncoder) ( zapcore.ObjectMarshaler) error {
	.appendSep()
	return .encodeObject()
}

func ( *jsonEncoder) ( zapcore.ObjectMarshaler) error {
	.appendOpenObject()
	 := .nested()
	 := .MarshalLogObject()
	.complete()
	.jsonState = 
	.appendCloseObject()
	return 
}

//
// Namespace
//

func ( *jsonEncoder) ( string) {
	.appendKey()
	.appendOpenObject()
	.prev = false
	.depth++
}