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

// ABitOfEverythingServiceUpdateV23Reader is a Reader for the ABitOfEverythingServiceUpdateV23 structure.
type ABitOfEverythingServiceUpdateV23Reader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceUpdateV23Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceUpdateV23OK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceUpdateV23Forbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceUpdateV23NotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceUpdateV23IMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceUpdateV23InternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceUpdateV23Default(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
	}
}

// NewABitOfEverythingServiceUpdateV23OK creates a ABitOfEverythingServiceUpdateV23OK with default headers values
func NewABitOfEverythingServiceUpdateV23OK() *ABitOfEverythingServiceUpdateV23OK {
	return &ABitOfEverythingServiceUpdateV23OK{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceUpdateV23OK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23OK %s", 200, payload)
}

func (o *ABitOfEverythingServiceUpdateV23OK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23OK %s", 200, payload)
}

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

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

// NewABitOfEverythingServiceUpdateV23Forbidden creates a ABitOfEverythingServiceUpdateV23Forbidden with default headers values
func NewABitOfEverythingServiceUpdateV23Forbidden() *ABitOfEverythingServiceUpdateV23Forbidden {
	return &ABitOfEverythingServiceUpdateV23Forbidden{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceUpdateV23Forbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23Forbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceUpdateV23Forbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23Forbidden %s", 403, payload)
}

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

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

// NewABitOfEverythingServiceUpdateV23NotFound creates a ABitOfEverythingServiceUpdateV23NotFound with default headers values
func NewABitOfEverythingServiceUpdateV23NotFound() *ABitOfEverythingServiceUpdateV23NotFound {
	return &ABitOfEverythingServiceUpdateV23NotFound{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceUpdateV23NotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23NotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceUpdateV23NotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23NotFound %s", 404, payload)
}

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

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

// NewABitOfEverythingServiceUpdateV23IMATeapot creates a ABitOfEverythingServiceUpdateV23IMATeapot with default headers values
func NewABitOfEverythingServiceUpdateV23IMATeapot() *ABitOfEverythingServiceUpdateV23IMATeapot {
	return &ABitOfEverythingServiceUpdateV23IMATeapot{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceUpdateV23IMATeapot) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23IMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceUpdateV23IMATeapot) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23IMATeapot %s", 418, payload)
}

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

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

// NewABitOfEverythingServiceUpdateV23InternalServerError creates a ABitOfEverythingServiceUpdateV23InternalServerError with default headers values
func NewABitOfEverythingServiceUpdateV23InternalServerError() *ABitOfEverythingServiceUpdateV23InternalServerError {
	return &ABitOfEverythingServiceUpdateV23InternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceUpdateV23InternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23InternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceUpdateV23InternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] aBitOfEverythingServiceUpdateV23InternalServerError %s", 500, payload)
}

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

func (o *ABitOfEverythingServiceUpdateV23Default) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] ABitOfEverythingService_UpdateV23 default %s", o._statusCode, payload)
}

func (o *ABitOfEverythingServiceUpdateV23Default) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /v2a/example/a_bit_of_everything/{uuidName}][%d] ABitOfEverythingService_UpdateV23 default %s", o._statusCode, payload)
}

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

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