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

package operations

// 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/fiskerinc/cloud-services/pkg/ota_api/models"
)

// GetDittoCarstateReader is a Reader for the GetDittoCarstate structure.
type GetDittoCarstateReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetDittoCarstateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetDittoCarstateOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetDittoCarstateBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetDittoCarstateUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetDittoCarstateServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /ditto/carstate] GetDittoCarstate", response, response.Code())
	}
}

// NewGetDittoCarstateOK creates a GetDittoCarstateOK with default headers values
func NewGetDittoCarstateOK() *GetDittoCarstateOK {
	return &GetDittoCarstateOK{}
}

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

OK
*/
type GetDittoCarstateOK struct {
	Payload []interface{}
}

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

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

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

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

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

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

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

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

func (o *GetDittoCarstateOK) GetPayload() []interface{} {
	return o.Payload
}

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

// NewGetDittoCarstateBadRequest creates a GetDittoCarstateBadRequest with default headers values
func NewGetDittoCarstateBadRequest() *GetDittoCarstateBadRequest {
	return &GetDittoCarstateBadRequest{}
}

/*
GetDittoCarstateBadRequest describes a response with status code 400, with default header values.

Bad request
*/
type GetDittoCarstateBadRequest struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this get ditto carstate bad request response has a 2xx status code
func (o *GetDittoCarstateBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get ditto carstate bad request response has a 3xx status code
func (o *GetDittoCarstateBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get ditto carstate bad request response has a 4xx status code
func (o *GetDittoCarstateBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get ditto carstate bad request response has a 5xx status code
func (o *GetDittoCarstateBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this get ditto carstate bad request response a status code equal to that given
func (o *GetDittoCarstateBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the get ditto carstate bad request response
func (o *GetDittoCarstateBadRequest) Code() int {
	return 400
}

func (o *GetDittoCarstateBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /ditto/carstate][%d] getDittoCarstateBadRequest %s", 400, payload)
}

func (o *GetDittoCarstateBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /ditto/carstate][%d] getDittoCarstateBadRequest %s", 400, payload)
}

func (o *GetDittoCarstateBadRequest) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}

// NewGetDittoCarstateUnauthorized creates a GetDittoCarstateUnauthorized with default headers values
func NewGetDittoCarstateUnauthorized() *GetDittoCarstateUnauthorized {
	return &GetDittoCarstateUnauthorized{}
}

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

Unauthorized
*/
type GetDittoCarstateUnauthorized struct {
	Payload *models.CommonJSONError
}

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

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

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

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

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

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

func (o *GetDittoCarstateUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /ditto/carstate][%d] getDittoCarstateUnauthorized %s", 401, payload)
}

func (o *GetDittoCarstateUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /ditto/carstate][%d] getDittoCarstateUnauthorized %s", 401, payload)
}

func (o *GetDittoCarstateUnauthorized) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}

// NewGetDittoCarstateServiceUnavailable creates a GetDittoCarstateServiceUnavailable with default headers values
func NewGetDittoCarstateServiceUnavailable() *GetDittoCarstateServiceUnavailable {
	return &GetDittoCarstateServiceUnavailable{}
}

/*
GetDittoCarstateServiceUnavailable describes a response with status code 503, with default header values.

Service unavailable
*/
type GetDittoCarstateServiceUnavailable struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this get ditto carstate service unavailable response has a 2xx status code
func (o *GetDittoCarstateServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get ditto carstate service unavailable response has a 3xx status code
func (o *GetDittoCarstateServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get ditto carstate service unavailable response has a 4xx status code
func (o *GetDittoCarstateServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this get ditto carstate service unavailable response has a 5xx status code
func (o *GetDittoCarstateServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this get ditto carstate service unavailable response a status code equal to that given
func (o *GetDittoCarstateServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

// Code gets the status code for the get ditto carstate service unavailable response
func (o *GetDittoCarstateServiceUnavailable) Code() int {
	return 503
}

func (o *GetDittoCarstateServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /ditto/carstate][%d] getDittoCarstateServiceUnavailable %s", 503, payload)
}

func (o *GetDittoCarstateServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /ditto/carstate][%d] getDittoCarstateServiceUnavailable %s", 503, payload)
}

func (o *GetDittoCarstateServiceUnavailable) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}
