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

// ABitOfEverythingServiceDoubleColonReader is a Reader for the ABitOfEverythingServiceDoubleColon structure.
type ABitOfEverythingServiceDoubleColonReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceDoubleColonReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceDoubleColonOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceDoubleColonForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceDoubleColonNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceDoubleColonIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceDoubleColonInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceDoubleColonDefault(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
	}
}

// NewABitOfEverythingServiceDoubleColonOK creates a ABitOfEverythingServiceDoubleColonOK with default headers values
func NewABitOfEverythingServiceDoubleColonOK() *ABitOfEverythingServiceDoubleColonOK {
	return &ABitOfEverythingServiceDoubleColonOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceDoubleColonForbidden creates a ABitOfEverythingServiceDoubleColonForbidden with default headers values
func NewABitOfEverythingServiceDoubleColonForbidden() *ABitOfEverythingServiceDoubleColonForbidden {
	return &ABitOfEverythingServiceDoubleColonForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceDoubleColonNotFound creates a ABitOfEverythingServiceDoubleColonNotFound with default headers values
func NewABitOfEverythingServiceDoubleColonNotFound() *ABitOfEverythingServiceDoubleColonNotFound {
	return &ABitOfEverythingServiceDoubleColonNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceDoubleColonIMATeapot creates a ABitOfEverythingServiceDoubleColonIMATeapot with default headers values
func NewABitOfEverythingServiceDoubleColonIMATeapot() *ABitOfEverythingServiceDoubleColonIMATeapot {
	return &ABitOfEverythingServiceDoubleColonIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceDoubleColonInternalServerError creates a ABitOfEverythingServiceDoubleColonInternalServerError with default headers values
func NewABitOfEverythingServiceDoubleColonInternalServerError() *ABitOfEverythingServiceDoubleColonInternalServerError {
	return &ABitOfEverythingServiceDoubleColonInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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