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

// GetExperimentalReader is a Reader for the GetExperimental structure.
type GetExperimentalReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetExperimentalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetExperimentalOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetExperimentalUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /experimental] GetExperimental", response, response.Code())
	}
}

// NewGetExperimentalOK creates a GetExperimentalOK with default headers values
func NewGetExperimentalOK() *GetExperimentalOK {
	return &GetExperimentalOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetExperimentalUnauthorized creates a GetExperimentalUnauthorized with default headers values
func NewGetExperimentalUnauthorized() *GetExperimentalUnauthorized {
	return &GetExperimentalUnauthorized{}
}

/*
GetExperimentalUnauthorized describes a response with status code 401, with default header values.

wrong
*/
type GetExperimentalUnauthorized struct {
}

// IsSuccess returns true when this get experimental unauthorized response has a 2xx status code
func (o *GetExperimentalUnauthorized) IsSuccess() bool {
	return false
}

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

// IsClientError returns true when this get experimental unauthorized response has a 4xx status code
func (o *GetExperimentalUnauthorized) IsClientError() bool {
	return true
}

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

// IsCode returns true when this get experimental unauthorized response a status code equal to that given
func (o *GetExperimentalUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get experimental unauthorized response
func (o *GetExperimentalUnauthorized) Code() int {
	return 401
}

func (o *GetExperimentalUnauthorized) Error() string {
	return fmt.Sprintf("[GET /experimental][%d] getExperimentalUnauthorized", 401)
}

func (o *GetExperimentalUnauthorized) String() string {
	return fmt.Sprintf("[GET /experimental][%d] getExperimentalUnauthorized", 401)
}

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

	return nil
}
