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

// ABitOfEverythingServiceOverwriteRequestContentTypeReader is a Reader for the ABitOfEverythingServiceOverwriteRequestContentType structure.
type ABitOfEverythingServiceOverwriteRequestContentTypeReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServiceOverwriteRequestContentTypeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServiceOverwriteRequestContentTypeOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServiceOverwriteRequestContentTypeForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServiceOverwriteRequestContentTypeNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServiceOverwriteRequestContentTypeDefault(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
	}
}

// NewABitOfEverythingServiceOverwriteRequestContentTypeOK creates a ABitOfEverythingServiceOverwriteRequestContentTypeOK with default headers values
func NewABitOfEverythingServiceOverwriteRequestContentTypeOK() *ABitOfEverythingServiceOverwriteRequestContentTypeOK {
	return &ABitOfEverythingServiceOverwriteRequestContentTypeOK{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeOK %s", 200, payload)
}

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeOK %s", 200, payload)
}

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

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

// NewABitOfEverythingServiceOverwriteRequestContentTypeForbidden creates a ABitOfEverythingServiceOverwriteRequestContentTypeForbidden with default headers values
func NewABitOfEverythingServiceOverwriteRequestContentTypeForbidden() *ABitOfEverythingServiceOverwriteRequestContentTypeForbidden {
	return &ABitOfEverythingServiceOverwriteRequestContentTypeForbidden{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeForbidden %s", 403, payload)
}

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeForbidden %s", 403, payload)
}

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

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

// NewABitOfEverythingServiceOverwriteRequestContentTypeNotFound creates a ABitOfEverythingServiceOverwriteRequestContentTypeNotFound with default headers values
func NewABitOfEverythingServiceOverwriteRequestContentTypeNotFound() *ABitOfEverythingServiceOverwriteRequestContentTypeNotFound {
	return &ABitOfEverythingServiceOverwriteRequestContentTypeNotFound{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeNotFound %s", 404, payload)
}

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeNotFound %s", 404, payload)
}

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

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

// NewABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot creates a ABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot with default headers values
func NewABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot() *ABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot {
	return &ABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeIMATeapot %s", 418, payload)
}

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeIMATeapot) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeIMATeapot %s", 418, payload)
}

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

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

// NewABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError creates a ABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError with default headers values
func NewABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError() *ABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError {
	return &ABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeInternalServerError %s", 500, payload)
}

func (o *ABitOfEverythingServiceOverwriteRequestContentTypeInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /v2/example/overwriterequestcontenttype][%d] aBitOfEverythingServiceOverwriteRequestContentTypeInternalServerError %s", 500, payload)
}

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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