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

// ABitOfEverythingServiceTimeoutReader is a Reader for the ABitOfEverythingServiceTimeout structure.
type ABitOfEverythingServiceTimeoutReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceTimeoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceTimeoutOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceTimeoutForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceTimeoutNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceTimeoutIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceTimeoutInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceTimeoutDefault(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
	}
}

// NewABitOfEverythingServiceTimeoutOK creates a ABitOfEverythingServiceTimeoutOK with default headers values
func NewABitOfEverythingServiceTimeoutOK() *ABitOfEverythingServiceTimeoutOK {
	return &ABitOfEverythingServiceTimeoutOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceTimeoutForbidden creates a ABitOfEverythingServiceTimeoutForbidden with default headers values
func NewABitOfEverythingServiceTimeoutForbidden() *ABitOfEverythingServiceTimeoutForbidden {
	return &ABitOfEverythingServiceTimeoutForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceTimeoutNotFound creates a ABitOfEverythingServiceTimeoutNotFound with default headers values
func NewABitOfEverythingServiceTimeoutNotFound() *ABitOfEverythingServiceTimeoutNotFound {
	return &ABitOfEverythingServiceTimeoutNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceTimeoutIMATeapot creates a ABitOfEverythingServiceTimeoutIMATeapot with default headers values
func NewABitOfEverythingServiceTimeoutIMATeapot() *ABitOfEverythingServiceTimeoutIMATeapot {
	return &ABitOfEverythingServiceTimeoutIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceTimeoutInternalServerError creates a ABitOfEverythingServiceTimeoutInternalServerError with default headers values
func NewABitOfEverythingServiceTimeoutInternalServerError() *ABitOfEverythingServiceTimeoutInternalServerError {
	return &ABitOfEverythingServiceTimeoutInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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