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

// RestoreDashboardVersionByIDReader is a Reader for the RestoreDashboardVersionByID structure.
type RestoreDashboardVersionByIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RestoreDashboardVersionByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRestoreDashboardVersionByIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewRestoreDashboardVersionByIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewRestoreDashboardVersionByIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRestoreDashboardVersionByIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewRestoreDashboardVersionByIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /dashboards/id/{DashboardID}/restore] restoreDashboardVersionByID", response, response.Code())
	}
}

// NewRestoreDashboardVersionByIDOK creates a RestoreDashboardVersionByIDOK with default headers values
func NewRestoreDashboardVersionByIDOK() *RestoreDashboardVersionByIDOK {
	return &RestoreDashboardVersionByIDOK{}
}

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

(empty)
*/
type RestoreDashboardVersionByIDOK struct {
	Payload *models.RestoreDashboardVersionByIDOKBody
}

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

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

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

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

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

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

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

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

func (o *RestoreDashboardVersionByIDOK) GetPayload() *models.RestoreDashboardVersionByIDOKBody {
	return o.Payload
}

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

	o.Payload = new(models.RestoreDashboardVersionByIDOKBody)

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

	return nil
}

// NewRestoreDashboardVersionByIDUnauthorized creates a RestoreDashboardVersionByIDUnauthorized with default headers values
func NewRestoreDashboardVersionByIDUnauthorized() *RestoreDashboardVersionByIDUnauthorized {
	return &RestoreDashboardVersionByIDUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewRestoreDashboardVersionByIDForbidden creates a RestoreDashboardVersionByIDForbidden with default headers values
func NewRestoreDashboardVersionByIDForbidden() *RestoreDashboardVersionByIDForbidden {
	return &RestoreDashboardVersionByIDForbidden{}
}

/*
RestoreDashboardVersionByIDForbidden 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 RestoreDashboardVersionByIDForbidden struct {
	Payload *models.ErrorResponseBody
}

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

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

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

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

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

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

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

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

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

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

// NewRestoreDashboardVersionByIDNotFound creates a RestoreDashboardVersionByIDNotFound with default headers values
func NewRestoreDashboardVersionByIDNotFound() *RestoreDashboardVersionByIDNotFound {
	return &RestoreDashboardVersionByIDNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewRestoreDashboardVersionByIDInternalServerError creates a RestoreDashboardVersionByIDInternalServerError with default headers values
func NewRestoreDashboardVersionByIDInternalServerError() *RestoreDashboardVersionByIDInternalServerError {
	return &RestoreDashboardVersionByIDInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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