package gojay

import 

// EncodeBool encodes a bool to JSON
func ( *Encoder) ( bool) error {
	if .isPooled == 1 {
		panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder"))
	}
	_, _ = .encodeBool()
	,  := .Write()
	if  != nil {
		.err = 
		return 
	}
	return nil
}

// encodeBool encodes a bool to JSON
func ( *Encoder) ( bool) ([]byte, error) {
	.grow(5)
	if  {
		.writeString("true")
	} else {
		.writeString("false")
	}
	return .buf, .err
}

// AddBool adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( bool) {
	.Bool()
}

// AddBoolOmitEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( bool) {
	.BoolOmitEmpty()
}

// AddBoolNullEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( bool) {
	.BoolNullEmpty()
}

// AddBoolKey adds a bool to be encoded, must be used inside an object as it will encode a key.
func ( *Encoder) ( string,  bool) {
	.BoolKey(, )
}

// AddBoolKeyOmitEmpty adds a bool to be encoded and skips if it is zero value.
// Must be used inside an object as it will encode a key.
func ( *Encoder) ( string,  bool) {
	.BoolKeyOmitEmpty(, )
}

// AddBoolKeyNullEmpty adds a bool to be encoded and encodes `null` if it is zero value.
// Must be used inside an object as it will encode a key.
func ( *Encoder) ( string,  bool) {
	.BoolKeyNullEmpty(, )
}

// Bool adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( bool) {
	.grow(5)
	 := .getPreviousRune()
	if  != '[' {
		.writeByte(',')
	}
	if  {
		.writeString("true")
	} else {
		.writeString("false")
	}
}

// BoolOmitEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( bool) {
	if  == false {
		return
	}
	.grow(5)
	 := .getPreviousRune()
	if  != '[' {
		.writeByte(',')
	}
	.writeString("true")
}

// BoolNullEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
func ( *Encoder) ( bool) {
	.grow(5)
	 := .getPreviousRune()
	if  != '[' {
		.writeByte(',')
	}
	if  == false {
		.writeBytes(nullBytes)
		return
	}
	.writeString("true")
}

// BoolKey adds a bool to be encoded, must be used inside an object as it will encode a key.
func ( *Encoder) ( string,  bool) {
	if .hasKeys {
		if !.keyExists() {
			return
		}
	}
	.grow(5 + len())
	 := .getPreviousRune()
	if  != '{' {
		.writeByte(',')
	}
	.writeByte('"')
	.writeStringEscape()
	.writeBytes(objKey)
	.buf = strconv.AppendBool(.buf, )
}

// BoolKeyOmitEmpty adds a bool to be encoded and skips it if it is zero value.
// Must be used inside an object as it will encode a key.
func ( *Encoder) ( string,  bool) {
	if .hasKeys {
		if !.keyExists() {
			return
		}
	}
	if  == false {
		return
	}
	.grow(5 + len())
	 := .getPreviousRune()
	if  != '{' {
		.writeByte(',')
	}
	.writeByte('"')
	.writeStringEscape()
	.writeBytes(objKey)
	.buf = strconv.AppendBool(.buf, )
}

// BoolKeyNullEmpty adds a bool to be encoded and skips it if it is zero value.
// Must be used inside an object as it will encode a key.
func ( *Encoder) ( string,  bool) {
	if .hasKeys {
		if !.keyExists() {
			return
		}
	}
	.grow(5 + len())
	 := .getPreviousRune()
	if  != '{' {
		.writeByte(',')
	}
	.writeByte('"')
	.writeStringEscape()
	.writeBytes(objKey)
	if  == false {
		.writeBytes(nullBytes)
		return
	}
	.buf = strconv.AppendBool(.buf, )
}