package gojay

import (
	
)

// Encode encodes a value to JSON.
//
// If Encode cannot find a way to encode the type to JSON
// it will return an InvalidMarshalError.
func ( *Encoder) ( interface{}) error {
	if .isPooled == 1 {
		panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder"))
	}
	switch vt := .(type) {
	case string:
		return .EncodeString()
	case bool:
		return .EncodeBool()
	case MarshalerJSONArray:
		return .EncodeArray()
	case MarshalerJSONObject:
		return .EncodeObject()
	case int:
		return .EncodeInt()
	case int64:
		return .EncodeInt64()
	case int32:
		return .EncodeInt(int())
	case int8:
		return .EncodeInt(int())
	case uint64:
		return .EncodeUint64()
	case uint32:
		return .EncodeInt(int())
	case uint16:
		return .EncodeInt(int())
	case uint8:
		return .EncodeInt(int())
	case float64:
		return .EncodeFloat()
	case float32:
		return .EncodeFloat32()
	case *EmbeddedJSON:
		return .EncodeEmbeddedJSON()
	default:
		return InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, ))
	}
}

// AddInterface adds an interface{} to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( interface{}) {
	switch vt := .(type) {
	case string:
		.AddString()
	case bool:
		.AddBool()
	case MarshalerJSONArray:
		.AddArray()
	case MarshalerJSONObject:
		.AddObject()
	case int:
		.AddInt()
	case int64:
		.AddInt(int())
	case int32:
		.AddInt(int())
	case int8:
		.AddInt(int())
	case uint64:
		.AddUint64()
	case uint32:
		.AddInt(int())
	case uint16:
		.AddInt(int())
	case uint8:
		.AddInt(int())
	case float64:
		.AddFloat()
	case float32:
		.AddFloat32()
	default:
		if  != nil {
			.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, ))
			return
		}
		return
	}
}

// AddInterfaceKey adds an interface{} to be encoded, must be used inside an object as it will encode a key
func ( *Encoder) ( string,  interface{}) {
	switch vt := .(type) {
	case string:
		.AddStringKey(, )
	case bool:
		.AddBoolKey(, )
	case MarshalerJSONArray:
		.AddArrayKey(, )
	case MarshalerJSONObject:
		.AddObjectKey(, )
	case int:
		.AddIntKey(, )
	case int64:
		.AddIntKey(, int())
	case int32:
		.AddIntKey(, int())
	case int16:
		.AddIntKey(, int())
	case int8:
		.AddIntKey(, int())
	case uint64:
		.AddIntKey(, int())
	case uint32:
		.AddIntKey(, int())
	case uint16:
		.AddIntKey(, int())
	case uint8:
		.AddIntKey(, int())
	case float64:
		.AddFloatKey(, )
	case float32:
		.AddFloat32Key(, )
	default:
		if  != nil {
			.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, ))
			return
		}
		return
	}
}

// AddInterfaceKeyOmitEmpty adds an interface{} to be encoded, must be used inside an object as it will encode a key
func ( *Encoder) ( string,  interface{}) {
	switch vt := .(type) {
	case string:
		.AddStringKeyOmitEmpty(, )
	case bool:
		.AddBoolKeyOmitEmpty(, )
	case MarshalerJSONArray:
		.AddArrayKeyOmitEmpty(, )
	case MarshalerJSONObject:
		.AddObjectKeyOmitEmpty(, )
	case int:
		.AddIntKeyOmitEmpty(, )
	case int64:
		.AddIntKeyOmitEmpty(, int())
	case int32:
		.AddIntKeyOmitEmpty(, int())
	case int16:
		.AddIntKeyOmitEmpty(, int())
	case int8:
		.AddIntKeyOmitEmpty(, int())
	case uint64:
		.AddIntKeyOmitEmpty(, int())
	case uint32:
		.AddIntKeyOmitEmpty(, int())
	case uint16:
		.AddIntKeyOmitEmpty(, int())
	case uint8:
		.AddIntKeyOmitEmpty(, int())
	case float64:
		.AddFloatKeyOmitEmpty(, )
	case float32:
		.AddFloat32KeyOmitEmpty(, )
	default:
		if  != nil {
			.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, ))
			return
		}
		return
	}
}