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

package dashboard_versions

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

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

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

	"github.com/grafana/grafana-openapi-client-go/models"
)

// RestoreDashboardVersionByUIDReader is a Reader for the RestoreDashboardVersionByUID structure.
type RestoreDashboardVersionByUIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RestoreDashboardVersionByUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRestoreDashboardVersionByUIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewRestoreDashboardVersionByUIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewRestoreDashboardVersionByUIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRestoreDashboardVersionByUIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewRestoreDashboardVersionByUIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /dashboards/uid/{uid}/restore] restoreDashboardVersionByUID", response, response.Code())
	}
}

// NewRestoreDashboardVersionByUIDOK creates a RestoreDashboardVersionByUIDOK with default headers values
func NewRestoreDashboardVersionByUIDOK() *RestoreDashboardVersionByUIDOK {
	return &RestoreDashboardVersionByUIDOK{}
}

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

(empty)
*/
type RestoreDashboardVersionByUIDOK struct {
	Payload *models.RestoreDashboardVersionByUIDOKBody
}

// IsSuccess returns true when this restore dashboard version by Uid Ok response has a 2xx status code
func (o *RestoreDashboardVersionByUIDOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this restore dashboard version by Uid Ok response has a 3xx status code
func (o *RestoreDashboardVersionByUIDOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this restore dashboard version by Uid Ok response has a 4xx status code
func (o *RestoreDashboardVersionByUIDOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this restore dashboard version by Uid Ok response has a 5xx status code
func (o *RestoreDashboardVersionByUIDOK) IsServerError() bool {
	return false
}

// IsCode returns true when this restore dashboard version by Uid Ok response a status code equal to that given
func (o *RestoreDashboardVersionByUIDOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the restore dashboard version by Uid Ok response
func (o *RestoreDashboardVersionByUIDOK) Code() int {
	return 200
}

func (o *RestoreDashboardVersionByUIDOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidOk %s", 200, payload)
}

func (o *RestoreDashboardVersionByUIDOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidOk %s", 200, payload)
}

func (o *RestoreDashboardVersionByUIDOK) GetPayload() *models.RestoreDashboardVersionByUIDOKBody {
	return o.Payload
}

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

	o.Payload = new(models.RestoreDashboardVersionByUIDOKBody)

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

	return nil
}

// NewRestoreDashboardVersionByUIDUnauthorized creates a RestoreDashboardVersionByUIDUnauthorized with default headers values
func NewRestoreDashboardVersionByUIDUnauthorized() *RestoreDashboardVersionByUIDUnauthorized {
	return &RestoreDashboardVersionByUIDUnauthorized{}
}

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

UnauthorizedError is returned when the request is not authenticated.
*/
type RestoreDashboardVersionByUIDUnauthorized struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this restore dashboard version by Uid unauthorized response has a 2xx status code
func (o *RestoreDashboardVersionByUIDUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this restore dashboard version by Uid unauthorized response has a 3xx status code
func (o *RestoreDashboardVersionByUIDUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this restore dashboard version by Uid unauthorized response has a 4xx status code
func (o *RestoreDashboardVersionByUIDUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this restore dashboard version by Uid unauthorized response has a 5xx status code
func (o *RestoreDashboardVersionByUIDUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this restore dashboard version by Uid unauthorized response a status code equal to that given
func (o *RestoreDashboardVersionByUIDUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the restore dashboard version by Uid unauthorized response
func (o *RestoreDashboardVersionByUIDUnauthorized) Code() int {
	return 401
}

func (o *RestoreDashboardVersionByUIDUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidUnauthorized %s", 401, payload)
}

func (o *RestoreDashboardVersionByUIDUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidUnauthorized %s", 401, payload)
}

func (o *RestoreDashboardVersionByUIDUnauthorized) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewRestoreDashboardVersionByUIDForbidden creates a RestoreDashboardVersionByUIDForbidden with default headers values
func NewRestoreDashboardVersionByUIDForbidden() *RestoreDashboardVersionByUIDForbidden {
	return &RestoreDashboardVersionByUIDForbidden{}
}

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

ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
*/
type RestoreDashboardVersionByUIDForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this restore dashboard version by Uid forbidden response has a 2xx status code
func (o *RestoreDashboardVersionByUIDForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this restore dashboard version by Uid forbidden response has a 3xx status code
func (o *RestoreDashboardVersionByUIDForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this restore dashboard version by Uid forbidden response has a 4xx status code
func (o *RestoreDashboardVersionByUIDForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this restore dashboard version by Uid forbidden response has a 5xx status code
func (o *RestoreDashboardVersionByUIDForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this restore dashboard version by Uid forbidden response a status code equal to that given
func (o *RestoreDashboardVersionByUIDForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the restore dashboard version by Uid forbidden response
func (o *RestoreDashboardVersionByUIDForbidden) Code() int {
	return 403
}

func (o *RestoreDashboardVersionByUIDForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidForbidden %s", 403, payload)
}

func (o *RestoreDashboardVersionByUIDForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidForbidden %s", 403, payload)
}

func (o *RestoreDashboardVersionByUIDForbidden) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewRestoreDashboardVersionByUIDNotFound creates a RestoreDashboardVersionByUIDNotFound with default headers values
func NewRestoreDashboardVersionByUIDNotFound() *RestoreDashboardVersionByUIDNotFound {
	return &RestoreDashboardVersionByUIDNotFound{}
}

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

NotFoundError is returned when the requested resource was not found.
*/
type RestoreDashboardVersionByUIDNotFound struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this restore dashboard version by Uid not found response has a 2xx status code
func (o *RestoreDashboardVersionByUIDNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this restore dashboard version by Uid not found response has a 3xx status code
func (o *RestoreDashboardVersionByUIDNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this restore dashboard version by Uid not found response has a 4xx status code
func (o *RestoreDashboardVersionByUIDNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this restore dashboard version by Uid not found response has a 5xx status code
func (o *RestoreDashboardVersionByUIDNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this restore dashboard version by Uid not found response a status code equal to that given
func (o *RestoreDashboardVersionByUIDNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the restore dashboard version by Uid not found response
func (o *RestoreDashboardVersionByUIDNotFound) Code() int {
	return 404
}

func (o *RestoreDashboardVersionByUIDNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidNotFound %s", 404, payload)
}

func (o *RestoreDashboardVersionByUIDNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidNotFound %s", 404, payload)
}

func (o *RestoreDashboardVersionByUIDNotFound) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewRestoreDashboardVersionByUIDInternalServerError creates a RestoreDashboardVersionByUIDInternalServerError with default headers values
func NewRestoreDashboardVersionByUIDInternalServerError() *RestoreDashboardVersionByUIDInternalServerError {
	return &RestoreDashboardVersionByUIDInternalServerError{}
}

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

InternalServerError is a general error indicating something went wrong internally.
*/
type RestoreDashboardVersionByUIDInternalServerError struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this restore dashboard version by Uid internal server error response has a 2xx status code
func (o *RestoreDashboardVersionByUIDInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this restore dashboard version by Uid internal server error response has a 3xx status code
func (o *RestoreDashboardVersionByUIDInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this restore dashboard version by Uid internal server error response has a 4xx status code
func (o *RestoreDashboardVersionByUIDInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this restore dashboard version by Uid internal server error response has a 5xx status code
func (o *RestoreDashboardVersionByUIDInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this restore dashboard version by Uid internal server error response a status code equal to that given
func (o *RestoreDashboardVersionByUIDInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the restore dashboard version by Uid internal server error response
func (o *RestoreDashboardVersionByUIDInternalServerError) Code() int {
	return 500
}

func (o *RestoreDashboardVersionByUIDInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidInternalServerError %s", 500, payload)
}

func (o *RestoreDashboardVersionByUIDInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/restore][%d] restoreDashboardVersionByUidInternalServerError %s", 500, payload)
}

func (o *RestoreDashboardVersionByUIDInternalServerError) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}
