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

// ABitOfEverythingServiceOverwriteResponseContentTypeReader is a Reader for the ABitOfEverythingServiceOverwriteResponseContentType structure.
type ABitOfEverythingServiceOverwriteResponseContentTypeReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceOverwriteResponseContentTypeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceOverwriteResponseContentTypeOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceOverwriteResponseContentTypeForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceOverwriteResponseContentTypeNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceOverwriteResponseContentTypeIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceOverwriteResponseContentTypeInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceOverwriteResponseContentTypeDefault(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
	}
}

// NewABitOfEverythingServiceOverwriteResponseContentTypeOK creates a ABitOfEverythingServiceOverwriteResponseContentTypeOK with default headers values
func NewABitOfEverythingServiceOverwriteResponseContentTypeOK() *ABitOfEverythingServiceOverwriteResponseContentTypeOK {
	return &ABitOfEverythingServiceOverwriteResponseContentTypeOK{}
}

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

A successful response.
*/
type ABitOfEverythingServiceOverwriteResponseContentTypeOK struct {
	Payload string
}

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceOverwriteResponseContentTypeForbidden creates a ABitOfEverythingServiceOverwriteResponseContentTypeForbidden with default headers values
func NewABitOfEverythingServiceOverwriteResponseContentTypeForbidden() *ABitOfEverythingServiceOverwriteResponseContentTypeForbidden {
	return &ABitOfEverythingServiceOverwriteResponseContentTypeForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceOverwriteResponseContentTypeNotFound creates a ABitOfEverythingServiceOverwriteResponseContentTypeNotFound with default headers values
func NewABitOfEverythingServiceOverwriteResponseContentTypeNotFound() *ABitOfEverythingServiceOverwriteResponseContentTypeNotFound {
	return &ABitOfEverythingServiceOverwriteResponseContentTypeNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceOverwriteResponseContentTypeIMATeapot creates a ABitOfEverythingServiceOverwriteResponseContentTypeIMATeapot with default headers values
func NewABitOfEverythingServiceOverwriteResponseContentTypeIMATeapot() *ABitOfEverythingServiceOverwriteResponseContentTypeIMATeapot {
	return &ABitOfEverythingServiceOverwriteResponseContentTypeIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServiceOverwriteResponseContentTypeInternalServerError creates a ABitOfEverythingServiceOverwriteResponseContentTypeInternalServerError with default headers values
func NewABitOfEverythingServiceOverwriteResponseContentTypeInternalServerError() *ABitOfEverythingServiceOverwriteResponseContentTypeInternalServerError {
	return &ABitOfEverythingServiceOverwriteResponseContentTypeInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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