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

package experimental

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/go-swagger/go-swagger/examples/tutorials/client/models"
)

// PutExperimentalReader is a Reader for the PutExperimental structure.
type PutExperimentalReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutExperimentalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutExperimentalOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 204:
		result := NewPutExperimentalNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 405:
		result := NewPutExperimentalMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /experimental] PutExperimental", response, response.Code())
	}
}

// NewPutExperimentalOK creates a PutExperimentalOK with default headers values
func NewPutExperimentalOK() *PutExperimentalOK {
	return &PutExperimentalOK{}
}

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

OK
*/
type PutExperimentalOK struct {
	Payload *models.Item
}

// IsSuccess returns true when this put experimental o k response has a 2xx status code
func (o *PutExperimentalOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put experimental o k response has a 3xx status code
func (o *PutExperimentalOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put experimental o k response has a 4xx status code
func (o *PutExperimentalOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put experimental o k response has a 5xx status code
func (o *PutExperimentalOK) IsServerError() bool {
	return false
}

// IsCode returns true when this put experimental o k response a status code equal to that given
func (o *PutExperimentalOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the put experimental o k response
func (o *PutExperimentalOK) Code() int {
	return 200
}

func (o *PutExperimentalOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /experimental][%d] putExperimentalOK %s", 200, payload)
}

func (o *PutExperimentalOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /experimental][%d] putExperimentalOK %s", 200, payload)
}

func (o *PutExperimentalOK) GetPayload() *models.Item {
	return o.Payload
}

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

	o.Payload = new(models.Item)

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

	return nil
}

// NewPutExperimentalNoContent creates a PutExperimentalNoContent with default headers values
func NewPutExperimentalNoContent() *PutExperimentalNoContent {
	return &PutExperimentalNoContent{}
}

/*
PutExperimentalNoContent describes a response with status code 204, with default header values.

No change
*/
type PutExperimentalNoContent struct {
}

// IsSuccess returns true when this put experimental no content response has a 2xx status code
func (o *PutExperimentalNoContent) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put experimental no content response has a 3xx status code
func (o *PutExperimentalNoContent) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put experimental no content response has a 4xx status code
func (o *PutExperimentalNoContent) IsClientError() bool {
	return false
}

// IsServerError returns true when this put experimental no content response has a 5xx status code
func (o *PutExperimentalNoContent) IsServerError() bool {
	return false
}

// IsCode returns true when this put experimental no content response a status code equal to that given
func (o *PutExperimentalNoContent) IsCode(code int) bool {
	return code == 204
}

// Code gets the status code for the put experimental no content response
func (o *PutExperimentalNoContent) Code() int {
	return 204
}

func (o *PutExperimentalNoContent) Error() string {
	return fmt.Sprintf("[PUT /experimental][%d] putExperimentalNoContent", 204)
}

func (o *PutExperimentalNoContent) String() string {
	return fmt.Sprintf("[PUT /experimental][%d] putExperimentalNoContent", 204)
}

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

	return nil
}

// NewPutExperimentalMethodNotAllowed creates a PutExperimentalMethodNotAllowed with default headers values
func NewPutExperimentalMethodNotAllowed() *PutExperimentalMethodNotAllowed {
	return &PutExperimentalMethodNotAllowed{}
}

/*
PutExperimentalMethodNotAllowed describes a response with status code 405, with default header values.

very wrong
*/
type PutExperimentalMethodNotAllowed struct {
}

// IsSuccess returns true when this put experimental method not allowed response has a 2xx status code
func (o *PutExperimentalMethodNotAllowed) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put experimental method not allowed response has a 3xx status code
func (o *PutExperimentalMethodNotAllowed) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put experimental method not allowed response has a 4xx status code
func (o *PutExperimentalMethodNotAllowed) IsClientError() bool {
	return true
}

// IsServerError returns true when this put experimental method not allowed response has a 5xx status code
func (o *PutExperimentalMethodNotAllowed) IsServerError() bool {
	return false
}

// IsCode returns true when this put experimental method not allowed response a status code equal to that given
func (o *PutExperimentalMethodNotAllowed) IsCode(code int) bool {
	return code == 405
}

// Code gets the status code for the put experimental method not allowed response
func (o *PutExperimentalMethodNotAllowed) Code() int {
	return 405
}

func (o *PutExperimentalMethodNotAllowed) Error() string {
	return fmt.Sprintf("[PUT /experimental][%d] putExperimentalMethodNotAllowed", 405)
}

func (o *PutExperimentalMethodNotAllowed) String() string {
	return fmt.Sprintf("[PUT /experimental][%d] putExperimentalMethodNotAllowed", 405)
}

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

	return nil
}
