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

// ABitOfEverythingServiceUpdateReader is a Reader for the ABitOfEverythingServiceUpdate structure.
type ABitOfEverythingServiceUpdateReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceUpdateOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceUpdateForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceUpdateNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceUpdateIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceUpdateInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceUpdateDefault(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
	}
}

// NewABitOfEverythingServiceUpdateOK creates a ABitOfEverythingServiceUpdateOK with default headers values
func NewABitOfEverythingServiceUpdateOK() *ABitOfEverythingServiceUpdateOK {
	return &ABitOfEverythingServiceUpdateOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceUpdateForbidden creates a ABitOfEverythingServiceUpdateForbidden with default headers values
func NewABitOfEverythingServiceUpdateForbidden() *ABitOfEverythingServiceUpdateForbidden {
	return &ABitOfEverythingServiceUpdateForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceUpdateNotFound creates a ABitOfEverythingServiceUpdateNotFound with default headers values
func NewABitOfEverythingServiceUpdateNotFound() *ABitOfEverythingServiceUpdateNotFound {
	return &ABitOfEverythingServiceUpdateNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceUpdateIMATeapot creates a ABitOfEverythingServiceUpdateIMATeapot with default headers values
func NewABitOfEverythingServiceUpdateIMATeapot() *ABitOfEverythingServiceUpdateIMATeapot {
	return &ABitOfEverythingServiceUpdateIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceUpdateInternalServerError creates a ABitOfEverythingServiceUpdateInternalServerError with default headers values
func NewABitOfEverythingServiceUpdateInternalServerError() *ABitOfEverythingServiceUpdateInternalServerError {
	return &ABitOfEverythingServiceUpdateInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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