// Code generated by go-swagger; DO NOT EDIT.

package unannotated_echo_service

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

// UnannotatedEchoServiceEchoDeleteReader is a Reader for the UnannotatedEchoServiceEchoDelete structure.
type UnannotatedEchoServiceEchoDeleteReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UnannotatedEchoServiceEchoDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewUnannotatedEchoServiceEchoDeleteOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewUnannotatedEchoServiceEchoDeleteForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUnannotatedEchoServiceEchoDeleteNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewUnannotatedEchoServiceEchoDeleteDefault(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
	}
}

// NewUnannotatedEchoServiceEchoDeleteOK creates a UnannotatedEchoServiceEchoDeleteOK with default headers values
func NewUnannotatedEchoServiceEchoDeleteOK() *UnannotatedEchoServiceEchoDeleteOK {
	return &UnannotatedEchoServiceEchoDeleteOK{}
}

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

A successful response.
*/
type UnannotatedEchoServiceEchoDeleteOK struct {
	Payload *models.ExamplepbUnannotatedSimpleMessage
}

// IsSuccess returns true when this unannotated echo service echo delete o k response has a 2xx status code
func (o *UnannotatedEchoServiceEchoDeleteOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this unannotated echo service echo delete o k response has a 3xx status code
func (o *UnannotatedEchoServiceEchoDeleteOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this unannotated echo service echo delete o k response has a 4xx status code
func (o *UnannotatedEchoServiceEchoDeleteOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this unannotated echo service echo delete o k response has a 5xx status code
func (o *UnannotatedEchoServiceEchoDeleteOK) IsServerError() bool {
	return false
}

// IsCode returns true when this unannotated echo service echo delete o k response a status code equal to that given
func (o *UnannotatedEchoServiceEchoDeleteOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the unannotated echo service echo delete o k response
func (o *UnannotatedEchoServiceEchoDeleteOK) Code() int {
	return 200
}

func (o *UnannotatedEchoServiceEchoDeleteOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /v1/example/echo_delete][%d] unannotatedEchoServiceEchoDeleteOK %s", 200, payload)
}

func (o *UnannotatedEchoServiceEchoDeleteOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /v1/example/echo_delete][%d] unannotatedEchoServiceEchoDeleteOK %s", 200, payload)
}

func (o *UnannotatedEchoServiceEchoDeleteOK) GetPayload() *models.ExamplepbUnannotatedSimpleMessage {
	return o.Payload
}

func (o *UnannotatedEchoServiceEchoDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ExamplepbUnannotatedSimpleMessage)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewUnannotatedEchoServiceEchoDeleteForbidden creates a UnannotatedEchoServiceEchoDeleteForbidden with default headers values
func NewUnannotatedEchoServiceEchoDeleteForbidden() *UnannotatedEchoServiceEchoDeleteForbidden {
	return &UnannotatedEchoServiceEchoDeleteForbidden{}
}

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

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

// IsSuccess returns true when this unannotated echo service echo delete forbidden response has a 2xx status code
func (o *UnannotatedEchoServiceEchoDeleteForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this unannotated echo service echo delete forbidden response has a 3xx status code
func (o *UnannotatedEchoServiceEchoDeleteForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this unannotated echo service echo delete forbidden response has a 4xx status code
func (o *UnannotatedEchoServiceEchoDeleteForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this unannotated echo service echo delete forbidden response has a 5xx status code
func (o *UnannotatedEchoServiceEchoDeleteForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this unannotated echo service echo delete forbidden response a status code equal to that given
func (o *UnannotatedEchoServiceEchoDeleteForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the unannotated echo service echo delete forbidden response
func (o *UnannotatedEchoServiceEchoDeleteForbidden) Code() int {
	return 403
}

func (o *UnannotatedEchoServiceEchoDeleteForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /v1/example/echo_delete][%d] unannotatedEchoServiceEchoDeleteForbidden %s", 403, payload)
}

func (o *UnannotatedEchoServiceEchoDeleteForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /v1/example/echo_delete][%d] unannotatedEchoServiceEchoDeleteForbidden %s", 403, payload)
}

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

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

// NewUnannotatedEchoServiceEchoDeleteNotFound creates a UnannotatedEchoServiceEchoDeleteNotFound with default headers values
func NewUnannotatedEchoServiceEchoDeleteNotFound() *UnannotatedEchoServiceEchoDeleteNotFound {
	return &UnannotatedEchoServiceEchoDeleteNotFound{}
}

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

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

// IsSuccess returns true when this unannotated echo service echo delete not found response has a 2xx status code
func (o *UnannotatedEchoServiceEchoDeleteNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this unannotated echo service echo delete not found response has a 3xx status code
func (o *UnannotatedEchoServiceEchoDeleteNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this unannotated echo service echo delete not found response has a 4xx status code
func (o *UnannotatedEchoServiceEchoDeleteNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this unannotated echo service echo delete not found response has a 5xx status code
func (o *UnannotatedEchoServiceEchoDeleteNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this unannotated echo service echo delete not found response a status code equal to that given
func (o *UnannotatedEchoServiceEchoDeleteNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the unannotated echo service echo delete not found response
func (o *UnannotatedEchoServiceEchoDeleteNotFound) Code() int {
	return 404
}

func (o *UnannotatedEchoServiceEchoDeleteNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /v1/example/echo_delete][%d] unannotatedEchoServiceEchoDeleteNotFound %s", 404, payload)
}

func (o *UnannotatedEchoServiceEchoDeleteNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /v1/example/echo_delete][%d] unannotatedEchoServiceEchoDeleteNotFound %s", 404, payload)
}

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

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

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

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

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

	Payload *models.RPCStatus
}

// IsSuccess returns true when this unannotated echo service echo delete default response has a 2xx status code
func (o *UnannotatedEchoServiceEchoDeleteDefault) IsSuccess() bool {
	return o._statusCode/100 == 2
}

// IsRedirect returns true when this unannotated echo service echo delete default response has a 3xx status code
func (o *UnannotatedEchoServiceEchoDeleteDefault) IsRedirect() bool {
	return o._statusCode/100 == 3
}

// IsClientError returns true when this unannotated echo service echo delete default response has a 4xx status code
func (o *UnannotatedEchoServiceEchoDeleteDefault) IsClientError() bool {
	return o._statusCode/100 == 4
}

// IsServerError returns true when this unannotated echo service echo delete default response has a 5xx status code
func (o *UnannotatedEchoServiceEchoDeleteDefault) IsServerError() bool {
	return o._statusCode/100 == 5
}

// IsCode returns true when this unannotated echo service echo delete default response a status code equal to that given
func (o *UnannotatedEchoServiceEchoDeleteDefault) IsCode(code int) bool {
	return o._statusCode == code
}

// Code gets the status code for the unannotated echo service echo delete default response
func (o *UnannotatedEchoServiceEchoDeleteDefault) Code() int {
	return o._statusCode
}

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

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

func (o *UnannotatedEchoServiceEchoDeleteDefault) GetPayload() *models.RPCStatus {
	return o.Payload
}

func (o *UnannotatedEchoServiceEchoDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.RPCStatus)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}
