// Code generated by go-swagger; DO NOT EDIT.

package echo_rpc

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/abe/models"
)

// ABitOfEverythingServiceEcho3Reader is a Reader for the ABitOfEverythingServiceEcho3 structure.
type ABitOfEverythingServiceEcho3Reader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceEcho3Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceEcho3OK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceEcho3Forbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceEcho3NotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceEcho3IMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceEcho3InternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewABitOfEverythingServiceEcho3ServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceEcho3Default(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		if response.Code()/100 == 2 {
			return result, nil
		}
		return nil, result
	}
}

// NewABitOfEverythingServiceEcho3OK creates a ABitOfEverythingServiceEcho3OK with default headers values
func NewABitOfEverythingServiceEcho3OK() *ABitOfEverythingServiceEcho3OK {
	return &ABitOfEverythingServiceEcho3OK{}
}

/*
ABitOfEverythingServiceEcho3OK describes a response with status code 200, with default header values.

A successful response.
*/
type ABitOfEverythingServiceEcho3OK struct {
	Payload *models.SubStringMessage
}

// IsSuccess returns true when this a bit of everything service echo3 o k response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3OK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this a bit of everything service echo3 o k response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3OK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this a bit of everything service echo3 o k response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3OK) IsClientError() bool {
	return false
}

// IsServerError returns true when this a bit of everything service echo3 o k response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3OK) IsServerError() bool {
	return false
}

// IsCode returns true when this a bit of everything service echo3 o k response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3OK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the a bit of everything service echo3 o k response
func (o *ABitOfEverythingServiceEcho3OK) Code() int {
	return 200
}

func (o *ABitOfEverythingServiceEcho3OK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3OK %s", 200, payload)
}

func (o *ABitOfEverythingServiceEcho3OK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3OK %s", 200, payload)
}

func (o *ABitOfEverythingServiceEcho3OK) GetPayload() *models.SubStringMessage {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.SubStringMessage)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewABitOfEverythingServiceEcho3Forbidden creates a ABitOfEverythingServiceEcho3Forbidden with default headers values
func NewABitOfEverythingServiceEcho3Forbidden() *ABitOfEverythingServiceEcho3Forbidden {
	return &ABitOfEverythingServiceEcho3Forbidden{}
}

/*
ABitOfEverythingServiceEcho3Forbidden describes a response with status code 403, with default header values.

Returned when the user does not have permission to access the resource.
*/
type ABitOfEverythingServiceEcho3Forbidden struct {
	Payload any
}

// IsSuccess returns true when this a bit of everything service echo3 forbidden response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3Forbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this a bit of everything service echo3 forbidden response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3Forbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this a bit of everything service echo3 forbidden response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3Forbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this a bit of everything service echo3 forbidden response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3Forbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this a bit of everything service echo3 forbidden response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3Forbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the a bit of everything service echo3 forbidden response
func (o *ABitOfEverythingServiceEcho3Forbidden) Code() int {
	return 403
}

func (o *ABitOfEverythingServiceEcho3Forbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3Forbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceEcho3Forbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3Forbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceEcho3Forbidden) GetPayload() any {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewABitOfEverythingServiceEcho3NotFound creates a ABitOfEverythingServiceEcho3NotFound with default headers values
func NewABitOfEverythingServiceEcho3NotFound() *ABitOfEverythingServiceEcho3NotFound {
	return &ABitOfEverythingServiceEcho3NotFound{}
}

/*
ABitOfEverythingServiceEcho3NotFound describes a response with status code 404, with default header values.

Returned when the resource does not exist.
*/
type ABitOfEverythingServiceEcho3NotFound struct {
	Payload int64
}

// IsSuccess returns true when this a bit of everything service echo3 not found response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3NotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this a bit of everything service echo3 not found response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3NotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this a bit of everything service echo3 not found response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3NotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this a bit of everything service echo3 not found response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3NotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this a bit of everything service echo3 not found response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3NotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the a bit of everything service echo3 not found response
func (o *ABitOfEverythingServiceEcho3NotFound) Code() int {
	return 404
}

func (o *ABitOfEverythingServiceEcho3NotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3NotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceEcho3NotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3NotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceEcho3NotFound) GetPayload() int64 {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewABitOfEverythingServiceEcho3IMATeapot creates a ABitOfEverythingServiceEcho3IMATeapot with default headers values
func NewABitOfEverythingServiceEcho3IMATeapot() *ABitOfEverythingServiceEcho3IMATeapot {
	return &ABitOfEverythingServiceEcho3IMATeapot{}
}

/*
ABitOfEverythingServiceEcho3IMATeapot describes a response with status code 418, with default header values.

I'm a teapot.
*/
type ABitOfEverythingServiceEcho3IMATeapot struct {
	Payload models.ExamplepbNumericEnum
}

// IsSuccess returns true when this a bit of everything service echo3 i m a teapot response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3IMATeapot) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this a bit of everything service echo3 i m a teapot response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3IMATeapot) IsRedirect() bool {
	return false
}

// IsClientError returns true when this a bit of everything service echo3 i m a teapot response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3IMATeapot) IsClientError() bool {
	return true
}

// IsServerError returns true when this a bit of everything service echo3 i m a teapot response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3IMATeapot) IsServerError() bool {
	return false
}

// IsCode returns true when this a bit of everything service echo3 i m a teapot response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3IMATeapot) IsCode(code int) bool {
	return code == 418
}

// Code gets the status code for the a bit of everything service echo3 i m a teapot response
func (o *ABitOfEverythingServiceEcho3IMATeapot) Code() int {
	return 418
}

func (o *ABitOfEverythingServiceEcho3IMATeapot) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3IMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceEcho3IMATeapot) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3IMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceEcho3IMATeapot) GetPayload() models.ExamplepbNumericEnum {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3IMATeapot) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewABitOfEverythingServiceEcho3InternalServerError creates a ABitOfEverythingServiceEcho3InternalServerError with default headers values
func NewABitOfEverythingServiceEcho3InternalServerError() *ABitOfEverythingServiceEcho3InternalServerError {
	return &ABitOfEverythingServiceEcho3InternalServerError{}
}

/*
ABitOfEverythingServiceEcho3InternalServerError describes a response with status code 500, with default header values.

Server error
*/
type ABitOfEverythingServiceEcho3InternalServerError struct {
	Payload *models.ExamplepbErrorResponse
}

// IsSuccess returns true when this a bit of everything service echo3 internal server error response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3InternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this a bit of everything service echo3 internal server error response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3InternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this a bit of everything service echo3 internal server error response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3InternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this a bit of everything service echo3 internal server error response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3InternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this a bit of everything service echo3 internal server error response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3InternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the a bit of everything service echo3 internal server error response
func (o *ABitOfEverythingServiceEcho3InternalServerError) Code() int {
	return 500
}

func (o *ABitOfEverythingServiceEcho3InternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3InternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceEcho3InternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3InternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceEcho3InternalServerError) GetPayload() *models.ExamplepbErrorResponse {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ExamplepbErrorResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewABitOfEverythingServiceEcho3ServiceUnavailable creates a ABitOfEverythingServiceEcho3ServiceUnavailable with default headers values
func NewABitOfEverythingServiceEcho3ServiceUnavailable() *ABitOfEverythingServiceEcho3ServiceUnavailable {
	return &ABitOfEverythingServiceEcho3ServiceUnavailable{}
}

/*
ABitOfEverythingServiceEcho3ServiceUnavailable describes a response with status code 503, with default header values.

Returned when the resource is temporarily unavailable.
*/
type ABitOfEverythingServiceEcho3ServiceUnavailable struct {
	Payload any
}

// IsSuccess returns true when this a bit of everything service echo3 service unavailable response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this a bit of everything service echo3 service unavailable response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this a bit of everything service echo3 service unavailable response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this a bit of everything service echo3 service unavailable response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this a bit of everything service echo3 service unavailable response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

// Code gets the status code for the a bit of everything service echo3 service unavailable response
func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) Code() int {
	return 503
}

func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3ServiceUnavailable %s", 503, payload)
}

func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] aBitOfEverythingServiceEcho3ServiceUnavailable %s", 503, payload)
}

func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) GetPayload() any {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3ServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewABitOfEverythingServiceEcho3Default creates a ABitOfEverythingServiceEcho3Default with default headers values
func NewABitOfEverythingServiceEcho3Default(code int) *ABitOfEverythingServiceEcho3Default {
	return &ABitOfEverythingServiceEcho3Default{
		_statusCode: code,
	}
}

/*
ABitOfEverythingServiceEcho3Default describes a response with status code -1, with default header values.

An unexpected error response.
*/
type ABitOfEverythingServiceEcho3Default struct {
	_statusCode int

	Payload *models.GoogleRPCStatus
}

// IsSuccess returns true when this a bit of everything service echo3 default response has a 2xx status code
func (o *ABitOfEverythingServiceEcho3Default) IsSuccess() bool {
	return o._statusCode/100 == 2
}

// IsRedirect returns true when this a bit of everything service echo3 default response has a 3xx status code
func (o *ABitOfEverythingServiceEcho3Default) IsRedirect() bool {
	return o._statusCode/100 == 3
}

// IsClientError returns true when this a bit of everything service echo3 default response has a 4xx status code
func (o *ABitOfEverythingServiceEcho3Default) IsClientError() bool {
	return o._statusCode/100 == 4
}

// IsServerError returns true when this a bit of everything service echo3 default response has a 5xx status code
func (o *ABitOfEverythingServiceEcho3Default) IsServerError() bool {
	return o._statusCode/100 == 5
}

// IsCode returns true when this a bit of everything service echo3 default response a status code equal to that given
func (o *ABitOfEverythingServiceEcho3Default) IsCode(code int) bool {
	return o._statusCode == code
}

// Code gets the status code for the a bit of everything service echo3 default response
func (o *ABitOfEverythingServiceEcho3Default) Code() int {
	return o._statusCode
}

func (o *ABitOfEverythingServiceEcho3Default) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] ABitOfEverythingService_Echo3 default %s", o._statusCode, payload)
}

func (o *ABitOfEverythingServiceEcho3Default) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/echo][%d] ABitOfEverythingService_Echo3 default %s", o._statusCode, payload)
}

func (o *ABitOfEverythingServiceEcho3Default) GetPayload() *models.GoogleRPCStatus {
	return o.Payload
}

func (o *ABitOfEverythingServiceEcho3Default) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.GoogleRPCStatus)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}
