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

// ABitOfEverythingServicePostOneofEnumReader is a Reader for the ABitOfEverythingServicePostOneofEnum structure.
type ABitOfEverythingServicePostOneofEnumReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServicePostOneofEnumReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServicePostOneofEnumOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServicePostOneofEnumForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServicePostOneofEnumNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServicePostOneofEnumIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServicePostOneofEnumInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServicePostOneofEnumDefault(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
	}
}

// NewABitOfEverythingServicePostOneofEnumOK creates a ABitOfEverythingServicePostOneofEnumOK with default headers values
func NewABitOfEverythingServicePostOneofEnumOK() *ABitOfEverythingServicePostOneofEnumOK {
	return &ABitOfEverythingServicePostOneofEnumOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServicePostOneofEnumForbidden creates a ABitOfEverythingServicePostOneofEnumForbidden with default headers values
func NewABitOfEverythingServicePostOneofEnumForbidden() *ABitOfEverythingServicePostOneofEnumForbidden {
	return &ABitOfEverythingServicePostOneofEnumForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServicePostOneofEnumNotFound creates a ABitOfEverythingServicePostOneofEnumNotFound with default headers values
func NewABitOfEverythingServicePostOneofEnumNotFound() *ABitOfEverythingServicePostOneofEnumNotFound {
	return &ABitOfEverythingServicePostOneofEnumNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServicePostOneofEnumIMATeapot creates a ABitOfEverythingServicePostOneofEnumIMATeapot with default headers values
func NewABitOfEverythingServicePostOneofEnumIMATeapot() *ABitOfEverythingServicePostOneofEnumIMATeapot {
	return &ABitOfEverythingServicePostOneofEnumIMATeapot{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewABitOfEverythingServicePostOneofEnumInternalServerError creates a ABitOfEverythingServicePostOneofEnumInternalServerError with default headers values
func NewABitOfEverythingServicePostOneofEnumInternalServerError() *ABitOfEverythingServicePostOneofEnumInternalServerError {
	return &ABitOfEverythingServicePostOneofEnumInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

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

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

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

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

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