package pgproto3

import (
	
	
	

	
)

// AuthenticationCleartextPassword is a message sent from the backend indicating that a clear-text password is required.
type AuthenticationCleartextPassword struct{}

// Backend identifies this message as sendable by the PostgreSQL backend.
func (*AuthenticationCleartextPassword) () {}

// Backend identifies this message as an authentication response.
func (*AuthenticationCleartextPassword) () {}

// Decode decodes src into dst. src must contain the complete message with the exception of the initial 1 byte message
// type identifier and 4 byte message length.
func ( *AuthenticationCleartextPassword) ( []byte) error {
	if len() != 4 {
		return errors.New("bad authentication message size")
	}

	 := binary.BigEndian.Uint32()

	if  != AuthTypeCleartextPassword {
		return errors.New("bad auth type")
	}

	return nil
}

// Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
func ( *AuthenticationCleartextPassword) ( []byte) ([]byte, error) {
	,  := beginMessage(, 'R')
	 = pgio.AppendUint32(, AuthTypeCleartextPassword)
	return finishMessage(, )
}

// MarshalJSON implements encoding/json.Marshaler.
func ( AuthenticationCleartextPassword) () ([]byte, error) {
	return json.Marshal(struct {
		 string
	}{
		: "AuthenticationCleartextPassword",
	})
}