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

package a_bit_of_everything

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"
)

// ABitOfEverythingServiceDeepPathEchoReader is a Reader for the ABitOfEverythingServiceDeepPathEcho structure.
type ABitOfEverythingServiceDeepPathEchoReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceDeepPathEchoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceDeepPathEchoOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceDeepPathEchoForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceDeepPathEchoNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceDeepPathEchoIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceDeepPathEchoInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceDeepPathEchoDefault(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
	}
}

// NewABitOfEverythingServiceDeepPathEchoOK creates a ABitOfEverythingServiceDeepPathEchoOK with default headers values
func NewABitOfEverythingServiceDeepPathEchoOK() *ABitOfEverythingServiceDeepPathEchoOK {
	return &ABitOfEverythingServiceDeepPathEchoOK{}
}

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

A successful response.
*/
type ABitOfEverythingServiceDeepPathEchoOK struct {
	Payload *models.ExamplepbABitOfEverything
}

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

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

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

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

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

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

func (o *ABitOfEverythingServiceDeepPathEchoOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoOK %s", 200, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoOK %s", 200, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoOK) GetPayload() *models.ExamplepbABitOfEverything {
	return o.Payload
}

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

	o.Payload = new(models.ExamplepbABitOfEverything)

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

	return nil
}

// NewABitOfEverythingServiceDeepPathEchoForbidden creates a ABitOfEverythingServiceDeepPathEchoForbidden with default headers values
func NewABitOfEverythingServiceDeepPathEchoForbidden() *ABitOfEverythingServiceDeepPathEchoForbidden {
	return &ABitOfEverythingServiceDeepPathEchoForbidden{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceDeepPathEchoForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoForbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoForbidden %s", 403, payload)
}

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

func (o *ABitOfEverythingServiceDeepPathEchoForbidden) 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
}

// NewABitOfEverythingServiceDeepPathEchoNotFound creates a ABitOfEverythingServiceDeepPathEchoNotFound with default headers values
func NewABitOfEverythingServiceDeepPathEchoNotFound() *ABitOfEverythingServiceDeepPathEchoNotFound {
	return &ABitOfEverythingServiceDeepPathEchoNotFound{}
}

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

Returned when the resource does not exist.
*/
type ABitOfEverythingServiceDeepPathEchoNotFound struct {
	Payload string
}

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

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

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

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

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

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

func (o *ABitOfEverythingServiceDeepPathEchoNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoNotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoNotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoNotFound) GetPayload() string {
	return o.Payload
}

func (o *ABitOfEverythingServiceDeepPathEchoNotFound) 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
}

// NewABitOfEverythingServiceDeepPathEchoIMATeapot creates a ABitOfEverythingServiceDeepPathEchoIMATeapot with default headers values
func NewABitOfEverythingServiceDeepPathEchoIMATeapot() *ABitOfEverythingServiceDeepPathEchoIMATeapot {
	return &ABitOfEverythingServiceDeepPathEchoIMATeapot{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceDeepPathEchoIMATeapot) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoIMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoIMATeapot) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoIMATeapot %s", 418, payload)
}

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

func (o *ABitOfEverythingServiceDeepPathEchoIMATeapot) 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
}

// NewABitOfEverythingServiceDeepPathEchoInternalServerError creates a ABitOfEverythingServiceDeepPathEchoInternalServerError with default headers values
func NewABitOfEverythingServiceDeepPathEchoInternalServerError() *ABitOfEverythingServiceDeepPathEchoInternalServerError {
	return &ABitOfEverythingServiceDeepPathEchoInternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceDeepPathEchoInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoInternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] aBitOfEverythingServiceDeepPathEchoInternalServerError %s", 500, payload)
}

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

func (o *ABitOfEverythingServiceDeepPathEchoInternalServerError) 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
}

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

func (o *ABitOfEverythingServiceDeepPathEchoDefault) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] ABitOfEverythingService_DeepPathEcho default %s", o._statusCode, payload)
}

func (o *ABitOfEverythingServiceDeepPathEchoDefault) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v1/example/deep_path/{singleNested.name}][%d] ABitOfEverythingService_DeepPathEcho default %s", o._statusCode, payload)
}

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

func (o *ABitOfEverythingServiceDeepPathEchoDefault) 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
}
