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

// ABitOfEverythingServiceErrorWithDetailsReader is a Reader for the ABitOfEverythingServiceErrorWithDetails structure.
type ABitOfEverythingServiceErrorWithDetailsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceErrorWithDetailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceErrorWithDetailsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceErrorWithDetailsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceErrorWithDetailsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceErrorWithDetailsIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceErrorWithDetailsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceErrorWithDetailsDefault(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
	}
}

// NewABitOfEverythingServiceErrorWithDetailsOK creates a ABitOfEverythingServiceErrorWithDetailsOK with default headers values
func NewABitOfEverythingServiceErrorWithDetailsOK() *ABitOfEverythingServiceErrorWithDetailsOK {
	return &ABitOfEverythingServiceErrorWithDetailsOK{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceErrorWithDetailsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsOK %s", 200, payload)
}

func (o *ABitOfEverythingServiceErrorWithDetailsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsOK %s", 200, payload)
}

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

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

// NewABitOfEverythingServiceErrorWithDetailsForbidden creates a ABitOfEverythingServiceErrorWithDetailsForbidden with default headers values
func NewABitOfEverythingServiceErrorWithDetailsForbidden() *ABitOfEverythingServiceErrorWithDetailsForbidden {
	return &ABitOfEverythingServiceErrorWithDetailsForbidden{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceErrorWithDetailsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsForbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceErrorWithDetailsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsForbidden %s", 403, payload)
}

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

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

// NewABitOfEverythingServiceErrorWithDetailsNotFound creates a ABitOfEverythingServiceErrorWithDetailsNotFound with default headers values
func NewABitOfEverythingServiceErrorWithDetailsNotFound() *ABitOfEverythingServiceErrorWithDetailsNotFound {
	return &ABitOfEverythingServiceErrorWithDetailsNotFound{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceErrorWithDetailsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsNotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceErrorWithDetailsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsNotFound %s", 404, payload)
}

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

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

// NewABitOfEverythingServiceErrorWithDetailsIMATeapot creates a ABitOfEverythingServiceErrorWithDetailsIMATeapot with default headers values
func NewABitOfEverythingServiceErrorWithDetailsIMATeapot() *ABitOfEverythingServiceErrorWithDetailsIMATeapot {
	return &ABitOfEverythingServiceErrorWithDetailsIMATeapot{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceErrorWithDetailsIMATeapot) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsIMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceErrorWithDetailsIMATeapot) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsIMATeapot %s", 418, payload)
}

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

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

// NewABitOfEverythingServiceErrorWithDetailsInternalServerError creates a ABitOfEverythingServiceErrorWithDetailsInternalServerError with default headers values
func NewABitOfEverythingServiceErrorWithDetailsInternalServerError() *ABitOfEverythingServiceErrorWithDetailsInternalServerError {
	return &ABitOfEverythingServiceErrorWithDetailsInternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceErrorWithDetailsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsInternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceErrorWithDetailsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] aBitOfEverythingServiceErrorWithDetailsInternalServerError %s", 500, payload)
}

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

func (o *ABitOfEverythingServiceErrorWithDetailsDefault) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] ABitOfEverythingService_ErrorWithDetails default %s", o._statusCode, payload)
}

func (o *ABitOfEverythingServiceErrorWithDetailsDefault) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /v2/example/errorwithdetails][%d] ABitOfEverythingService_ErrorWithDetails default %s", o._statusCode, payload)
}

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

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