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

// ABitOfEverythingServiceCustomReader is a Reader for the ABitOfEverythingServiceCustom structure.
type ABitOfEverythingServiceCustomReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceCustomReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceCustomOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceCustomForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceCustomNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceCustomIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceCustomInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceCustomDefault(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
	}
}

// NewABitOfEverythingServiceCustomOK creates a ABitOfEverythingServiceCustomOK with default headers values
func NewABitOfEverythingServiceCustomOK() *ABitOfEverythingServiceCustomOK {
	return &ABitOfEverythingServiceCustomOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCustomForbidden creates a ABitOfEverythingServiceCustomForbidden with default headers values
func NewABitOfEverythingServiceCustomForbidden() *ABitOfEverythingServiceCustomForbidden {
	return &ABitOfEverythingServiceCustomForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCustomNotFound creates a ABitOfEverythingServiceCustomNotFound with default headers values
func NewABitOfEverythingServiceCustomNotFound() *ABitOfEverythingServiceCustomNotFound {
	return &ABitOfEverythingServiceCustomNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCustomIMATeapot creates a ABitOfEverythingServiceCustomIMATeapot with default headers values
func NewABitOfEverythingServiceCustomIMATeapot() *ABitOfEverythingServiceCustomIMATeapot {
	return &ABitOfEverythingServiceCustomIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceCustomInternalServerError creates a ABitOfEverythingServiceCustomInternalServerError with default headers values
func NewABitOfEverythingServiceCustomInternalServerError() *ABitOfEverythingServiceCustomInternalServerError {
	return &ABitOfEverythingServiceCustomInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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