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

// ABitOfEverythingServiceCreateBodyReader is a Reader for the ABitOfEverythingServiceCreateBody structure.
type ABitOfEverythingServiceCreateBodyReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceCreateBodyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceCreateBodyOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceCreateBodyForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceCreateBodyNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceCreateBodyIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceCreateBodyInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceCreateBodyDefault(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
	}
}

// NewABitOfEverythingServiceCreateBodyOK creates a ABitOfEverythingServiceCreateBodyOK with default headers values
func NewABitOfEverythingServiceCreateBodyOK() *ABitOfEverythingServiceCreateBodyOK {
	return &ABitOfEverythingServiceCreateBodyOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCreateBodyForbidden creates a ABitOfEverythingServiceCreateBodyForbidden with default headers values
func NewABitOfEverythingServiceCreateBodyForbidden() *ABitOfEverythingServiceCreateBodyForbidden {
	return &ABitOfEverythingServiceCreateBodyForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCreateBodyNotFound creates a ABitOfEverythingServiceCreateBodyNotFound with default headers values
func NewABitOfEverythingServiceCreateBodyNotFound() *ABitOfEverythingServiceCreateBodyNotFound {
	return &ABitOfEverythingServiceCreateBodyNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCreateBodyIMATeapot creates a ABitOfEverythingServiceCreateBodyIMATeapot with default headers values
func NewABitOfEverythingServiceCreateBodyIMATeapot() *ABitOfEverythingServiceCreateBodyIMATeapot {
	return &ABitOfEverythingServiceCreateBodyIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCreateBodyInternalServerError creates a ABitOfEverythingServiceCreateBodyInternalServerError with default headers values
func NewABitOfEverythingServiceCreateBodyInternalServerError() *ABitOfEverythingServiceCreateBodyInternalServerError {
	return &ABitOfEverythingServiceCreateBodyInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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