package pgproto3

import (
	
	

	
)

type ParameterStatus struct {
	Name  string
	Value string
}

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

// 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 ( *ParameterStatus) ( []byte) error {
	 := bytes.NewBuffer()

	,  := .ReadBytes(0)
	if  != nil {
		return 
	}
	 := string([:len()-1])

	,  = .ReadBytes(0)
	if  != nil {
		return 
	}
	 := string([:len()-1])

	* = ParameterStatus{Name: , Value: }
	return nil
}

// Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
func ( *ParameterStatus) ( []byte) []byte {
	 = append(, 'S')
	 := len()
	 = pgio.AppendInt32(, -1)

	 = append(, .Name...)
	 = append(, 0)
	 = append(, .Value...)
	 = append(, 0)

	pgio.SetInt32([:], int32(len([:])))

	return 
}

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