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

// ABitOfEverythingServiceGetMessageWithBodyReader is a Reader for the ABitOfEverythingServiceGetMessageWithBody structure.
type ABitOfEverythingServiceGetMessageWithBodyReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceGetMessageWithBodyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceGetMessageWithBodyOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceGetMessageWithBodyForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceGetMessageWithBodyNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceGetMessageWithBodyIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceGetMessageWithBodyInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceGetMessageWithBodyDefault(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
	}
}

// NewABitOfEverythingServiceGetMessageWithBodyOK creates a ABitOfEverythingServiceGetMessageWithBodyOK with default headers values
func NewABitOfEverythingServiceGetMessageWithBodyOK() *ABitOfEverythingServiceGetMessageWithBodyOK {
	return &ABitOfEverythingServiceGetMessageWithBodyOK{}
}

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

A successful response.
*/
type ABitOfEverythingServiceGetMessageWithBodyOK struct {
	Payload any
}

// IsSuccess returns true when this a bit of everything service get message with body o k response has a 2xx status code
func (o *ABitOfEverythingServiceGetMessageWithBodyOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the a bit of everything service get message with body o k response
func (o *ABitOfEverythingServiceGetMessageWithBodyOK) Code() int {
	return 200
}

func (o *ABitOfEverythingServiceGetMessageWithBodyOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyOK %s", 200, payload)
}

func (o *ABitOfEverythingServiceGetMessageWithBodyOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyOK %s", 200, payload)
}

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

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

// NewABitOfEverythingServiceGetMessageWithBodyForbidden creates a ABitOfEverythingServiceGetMessageWithBodyForbidden with default headers values
func NewABitOfEverythingServiceGetMessageWithBodyForbidden() *ABitOfEverythingServiceGetMessageWithBodyForbidden {
	return &ABitOfEverythingServiceGetMessageWithBodyForbidden{}
}

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

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

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

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

// IsClientError returns true when this a bit of everything service get message with body forbidden response has a 4xx status code
func (o *ABitOfEverythingServiceGetMessageWithBodyForbidden) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the a bit of everything service get message with body forbidden response
func (o *ABitOfEverythingServiceGetMessageWithBodyForbidden) Code() int {
	return 403
}

func (o *ABitOfEverythingServiceGetMessageWithBodyForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyForbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceGetMessageWithBodyForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyForbidden %s", 403, payload)
}

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

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

// NewABitOfEverythingServiceGetMessageWithBodyNotFound creates a ABitOfEverythingServiceGetMessageWithBodyNotFound with default headers values
func NewABitOfEverythingServiceGetMessageWithBodyNotFound() *ABitOfEverythingServiceGetMessageWithBodyNotFound {
	return &ABitOfEverythingServiceGetMessageWithBodyNotFound{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service get message with body not found response
func (o *ABitOfEverythingServiceGetMessageWithBodyNotFound) Code() int {
	return 404
}

func (o *ABitOfEverythingServiceGetMessageWithBodyNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyNotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceGetMessageWithBodyNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyNotFound %s", 404, payload)
}

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

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

// NewABitOfEverythingServiceGetMessageWithBodyIMATeapot creates a ABitOfEverythingServiceGetMessageWithBodyIMATeapot with default headers values
func NewABitOfEverythingServiceGetMessageWithBodyIMATeapot() *ABitOfEverythingServiceGetMessageWithBodyIMATeapot {
	return &ABitOfEverythingServiceGetMessageWithBodyIMATeapot{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service get message with body i m a teapot response
func (o *ABitOfEverythingServiceGetMessageWithBodyIMATeapot) Code() int {
	return 418
}

func (o *ABitOfEverythingServiceGetMessageWithBodyIMATeapot) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyIMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceGetMessageWithBodyIMATeapot) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyIMATeapot %s", 418, payload)
}

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

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

// NewABitOfEverythingServiceGetMessageWithBodyInternalServerError creates a ABitOfEverythingServiceGetMessageWithBodyInternalServerError with default headers values
func NewABitOfEverythingServiceGetMessageWithBodyInternalServerError() *ABitOfEverythingServiceGetMessageWithBodyInternalServerError {
	return &ABitOfEverythingServiceGetMessageWithBodyInternalServerError{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service get message with body internal server error response
func (o *ABitOfEverythingServiceGetMessageWithBodyInternalServerError) Code() int {
	return 500
}

func (o *ABitOfEverythingServiceGetMessageWithBodyInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyInternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceGetMessageWithBodyInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] aBitOfEverythingServiceGetMessageWithBodyInternalServerError %s", 500, payload)
}

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

// Code gets the status code for the a bit of everything service get message with body default response
func (o *ABitOfEverythingServiceGetMessageWithBodyDefault) Code() int {
	return o._statusCode
}

func (o *ABitOfEverythingServiceGetMessageWithBodyDefault) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] ABitOfEverythingService_GetMessageWithBody default %s", o._statusCode, payload)
}

func (o *ABitOfEverythingServiceGetMessageWithBodyDefault) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/withbody/{id}][%d] ABitOfEverythingService_GetMessageWithBody default %s", o._statusCode, payload)
}

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

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