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

package folders

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

// GetFolderDescendantCountsReader is a Reader for the GetFolderDescendantCounts structure.
type GetFolderDescendantCountsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFolderDescendantCountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetFolderDescendantCountsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetFolderDescendantCountsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetFolderDescendantCountsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetFolderDescendantCountsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetFolderDescendantCountsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /folders/{folder_uid}/counts] getFolderDescendantCounts", response, response.Code())
	}
}

// NewGetFolderDescendantCountsOK creates a GetFolderDescendantCountsOK with default headers values
func NewGetFolderDescendantCountsOK() *GetFolderDescendantCountsOK {
	return &GetFolderDescendantCountsOK{}
}

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

(empty)
*/
type GetFolderDescendantCountsOK struct {
	Payload models.DescendantCounts
}

// IsSuccess returns true when this get folder descendant counts Ok response has a 2xx status code
func (o *GetFolderDescendantCountsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get folder descendant counts Ok response has a 3xx status code
func (o *GetFolderDescendantCountsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get folder descendant counts Ok response has a 4xx status code
func (o *GetFolderDescendantCountsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get folder descendant counts Ok response has a 5xx status code
func (o *GetFolderDescendantCountsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get folder descendant counts Ok response a status code equal to that given
func (o *GetFolderDescendantCountsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get folder descendant counts Ok response
func (o *GetFolderDescendantCountsOK) Code() int {
	return 200
}

func (o *GetFolderDescendantCountsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsOk %s", 200, payload)
}

func (o *GetFolderDescendantCountsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsOk %s", 200, payload)
}

func (o *GetFolderDescendantCountsOK) GetPayload() models.DescendantCounts {
	return o.Payload
}

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

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

	return nil
}

// NewGetFolderDescendantCountsUnauthorized creates a GetFolderDescendantCountsUnauthorized with default headers values
func NewGetFolderDescendantCountsUnauthorized() *GetFolderDescendantCountsUnauthorized {
	return &GetFolderDescendantCountsUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get folder descendant counts unauthorized response
func (o *GetFolderDescendantCountsUnauthorized) Code() int {
	return 401
}

func (o *GetFolderDescendantCountsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsUnauthorized %s", 401, payload)
}

func (o *GetFolderDescendantCountsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsUnauthorized %s", 401, payload)
}

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

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

// NewGetFolderDescendantCountsForbidden creates a GetFolderDescendantCountsForbidden with default headers values
func NewGetFolderDescendantCountsForbidden() *GetFolderDescendantCountsForbidden {
	return &GetFolderDescendantCountsForbidden{}
}

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

// IsSuccess returns true when this get folder descendant counts forbidden response has a 2xx status code
func (o *GetFolderDescendantCountsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get folder descendant counts forbidden response has a 3xx status code
func (o *GetFolderDescendantCountsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get folder descendant counts forbidden response has a 4xx status code
func (o *GetFolderDescendantCountsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get folder descendant counts forbidden response has a 5xx status code
func (o *GetFolderDescendantCountsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get folder descendant counts forbidden response a status code equal to that given
func (o *GetFolderDescendantCountsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get folder descendant counts forbidden response
func (o *GetFolderDescendantCountsForbidden) Code() int {
	return 403
}

func (o *GetFolderDescendantCountsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsForbidden %s", 403, payload)
}

func (o *GetFolderDescendantCountsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsForbidden %s", 403, payload)
}

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

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

// NewGetFolderDescendantCountsNotFound creates a GetFolderDescendantCountsNotFound with default headers values
func NewGetFolderDescendantCountsNotFound() *GetFolderDescendantCountsNotFound {
	return &GetFolderDescendantCountsNotFound{}
}

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

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

// IsSuccess returns true when this get folder descendant counts not found response has a 2xx status code
func (o *GetFolderDescendantCountsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get folder descendant counts not found response has a 3xx status code
func (o *GetFolderDescendantCountsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get folder descendant counts not found response has a 4xx status code
func (o *GetFolderDescendantCountsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this get folder descendant counts not found response has a 5xx status code
func (o *GetFolderDescendantCountsNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this get folder descendant counts not found response a status code equal to that given
func (o *GetFolderDescendantCountsNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the get folder descendant counts not found response
func (o *GetFolderDescendantCountsNotFound) Code() int {
	return 404
}

func (o *GetFolderDescendantCountsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsNotFound %s", 404, payload)
}

func (o *GetFolderDescendantCountsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsNotFound %s", 404, payload)
}

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

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

// NewGetFolderDescendantCountsInternalServerError creates a GetFolderDescendantCountsInternalServerError with default headers values
func NewGetFolderDescendantCountsInternalServerError() *GetFolderDescendantCountsInternalServerError {
	return &GetFolderDescendantCountsInternalServerError{}
}

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

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

// IsSuccess returns true when this get folder descendant counts internal server error response has a 2xx status code
func (o *GetFolderDescendantCountsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get folder descendant counts internal server error response has a 3xx status code
func (o *GetFolderDescendantCountsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get folder descendant counts internal server error response has a 4xx status code
func (o *GetFolderDescendantCountsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get folder descendant counts internal server error response has a 5xx status code
func (o *GetFolderDescendantCountsInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get folder descendant counts internal server error response a status code equal to that given
func (o *GetFolderDescendantCountsInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get folder descendant counts internal server error response
func (o *GetFolderDescendantCountsInternalServerError) Code() int {
	return 500
}

func (o *GetFolderDescendantCountsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsInternalServerError %s", 500, payload)
}

func (o *GetFolderDescendantCountsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /folders/{folder_uid}/counts][%d] getFolderDescendantCountsInternalServerError %s", 500, payload)
}

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

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