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

// ABitOfEverythingServicePostRequiredMessageTypeReader is a Reader for the ABitOfEverythingServicePostRequiredMessageType structure.
type ABitOfEverythingServicePostRequiredMessageTypeReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ABitOfEverythingServicePostRequiredMessageTypeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewABitOfEverythingServicePostRequiredMessageTypeOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewABitOfEverythingServicePostRequiredMessageTypeForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewABitOfEverythingServicePostRequiredMessageTypeNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 418:
		result := NewABitOfEverythingServicePostRequiredMessageTypeIMATeapot()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewABitOfEverythingServicePostRequiredMessageTypeInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewABitOfEverythingServicePostRequiredMessageTypeDefault(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
	}
}

// NewABitOfEverythingServicePostRequiredMessageTypeOK creates a ABitOfEverythingServicePostRequiredMessageTypeOK with default headers values
func NewABitOfEverythingServicePostRequiredMessageTypeOK() *ABitOfEverythingServicePostRequiredMessageTypeOK {
	return &ABitOfEverythingServicePostRequiredMessageTypeOK{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service post required message type o k response
func (o *ABitOfEverythingServicePostRequiredMessageTypeOK) Code() int {
	return 200
}

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

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

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

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

// NewABitOfEverythingServicePostRequiredMessageTypeForbidden creates a ABitOfEverythingServicePostRequiredMessageTypeForbidden with default headers values
func NewABitOfEverythingServicePostRequiredMessageTypeForbidden() *ABitOfEverythingServicePostRequiredMessageTypeForbidden {
	return &ABitOfEverythingServicePostRequiredMessageTypeForbidden{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service post required message type forbidden response
func (o *ABitOfEverythingServicePostRequiredMessageTypeForbidden) Code() int {
	return 403
}

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

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

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

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

// NewABitOfEverythingServicePostRequiredMessageTypeNotFound creates a ABitOfEverythingServicePostRequiredMessageTypeNotFound with default headers values
func NewABitOfEverythingServicePostRequiredMessageTypeNotFound() *ABitOfEverythingServicePostRequiredMessageTypeNotFound {
	return &ABitOfEverythingServicePostRequiredMessageTypeNotFound{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service post required message type not found response
func (o *ABitOfEverythingServicePostRequiredMessageTypeNotFound) Code() int {
	return 404
}

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

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

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

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

// NewABitOfEverythingServicePostRequiredMessageTypeIMATeapot creates a ABitOfEverythingServicePostRequiredMessageTypeIMATeapot with default headers values
func NewABitOfEverythingServicePostRequiredMessageTypeIMATeapot() *ABitOfEverythingServicePostRequiredMessageTypeIMATeapot {
	return &ABitOfEverythingServicePostRequiredMessageTypeIMATeapot{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service post required message type i m a teapot response
func (o *ABitOfEverythingServicePostRequiredMessageTypeIMATeapot) Code() int {
	return 418
}

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

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

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

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

// NewABitOfEverythingServicePostRequiredMessageTypeInternalServerError creates a ABitOfEverythingServicePostRequiredMessageTypeInternalServerError with default headers values
func NewABitOfEverythingServicePostRequiredMessageTypeInternalServerError() *ABitOfEverythingServicePostRequiredMessageTypeInternalServerError {
	return &ABitOfEverythingServicePostRequiredMessageTypeInternalServerError{}
}

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

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

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

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

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

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

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

// Code gets the status code for the a bit of everything service post required message type internal server error response
func (o *ABitOfEverythingServicePostRequiredMessageTypeInternalServerError) Code() int {
	return 500
}

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

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

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

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

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

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

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

	Payload *models.GoogleRPCStatus
}

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

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

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

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

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

// Code gets the status code for the a bit of everything service post required message type default response
func (o *ABitOfEverythingServicePostRequiredMessageTypeDefault) Code() int {
	return o._statusCode
}

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

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

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

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