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

// GetDashboardVersionByUIDReader is a Reader for the GetDashboardVersionByUID structure.
type GetDashboardVersionByUIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetDashboardVersionByUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetDashboardVersionByUIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetDashboardVersionByUIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetDashboardVersionByUIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetDashboardVersionByUIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetDashboardVersionByUIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}] getDashboardVersionByUID", response, response.Code())
	}
}

// NewGetDashboardVersionByUIDOK creates a GetDashboardVersionByUIDOK with default headers values
func NewGetDashboardVersionByUIDOK() *GetDashboardVersionByUIDOK {
	return &GetDashboardVersionByUIDOK{}
}

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

(empty)
*/
type GetDashboardVersionByUIDOK struct {
	Payload *models.DashboardVersionMeta
}

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

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

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

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

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

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

func (o *GetDashboardVersionByUIDOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidOk %s", 200, payload)
}

func (o *GetDashboardVersionByUIDOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidOk %s", 200, payload)
}

func (o *GetDashboardVersionByUIDOK) GetPayload() *models.DashboardVersionMeta {
	return o.Payload
}

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

	o.Payload = new(models.DashboardVersionMeta)

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

	return nil
}

// NewGetDashboardVersionByUIDUnauthorized creates a GetDashboardVersionByUIDUnauthorized with default headers values
func NewGetDashboardVersionByUIDUnauthorized() *GetDashboardVersionByUIDUnauthorized {
	return &GetDashboardVersionByUIDUnauthorized{}
}

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

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

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

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

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

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

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

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

func (o *GetDashboardVersionByUIDUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidUnauthorized %s", 401, payload)
}

func (o *GetDashboardVersionByUIDUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidUnauthorized %s", 401, payload)
}

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

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

// NewGetDashboardVersionByUIDForbidden creates a GetDashboardVersionByUIDForbidden with default headers values
func NewGetDashboardVersionByUIDForbidden() *GetDashboardVersionByUIDForbidden {
	return &GetDashboardVersionByUIDForbidden{}
}

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

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

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

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

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

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

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

func (o *GetDashboardVersionByUIDForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidForbidden %s", 403, payload)
}

func (o *GetDashboardVersionByUIDForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidForbidden %s", 403, payload)
}

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

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

// NewGetDashboardVersionByUIDNotFound creates a GetDashboardVersionByUIDNotFound with default headers values
func NewGetDashboardVersionByUIDNotFound() *GetDashboardVersionByUIDNotFound {
	return &GetDashboardVersionByUIDNotFound{}
}

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

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

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

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

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

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

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

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

func (o *GetDashboardVersionByUIDNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidNotFound %s", 404, payload)
}

func (o *GetDashboardVersionByUIDNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidNotFound %s", 404, payload)
}

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

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

// NewGetDashboardVersionByUIDInternalServerError creates a GetDashboardVersionByUIDInternalServerError with default headers values
func NewGetDashboardVersionByUIDInternalServerError() *GetDashboardVersionByUIDInternalServerError {
	return &GetDashboardVersionByUIDInternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *GetDashboardVersionByUIDInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidInternalServerError %s", 500, payload)
}

func (o *GetDashboardVersionByUIDInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions/{DashboardVersionID}][%d] getDashboardVersionByUidInternalServerError %s", 500, payload)
}

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

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