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

// GetCarupdatesstatusesReader is a Reader for the GetCarupdatesstatuses structure.
type GetCarupdatesstatusesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCarupdatesstatusesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCarupdatesstatusesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetCarupdatesstatusesBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetCarupdatesstatusesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetCarupdatesstatusesServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /carupdatesstatuses] GetCarupdatesstatuses", response, response.Code())
	}
}

// NewGetCarupdatesstatusesOK creates a GetCarupdatesstatusesOK with default headers values
func NewGetCarupdatesstatusesOK() *GetCarupdatesstatusesOK {
	return &GetCarupdatesstatusesOK{}
}

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

Car update statuses
*/
type GetCarupdatesstatusesOK struct {
	Payload *models.HandlersCarUpdateStatuses
}

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

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

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

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

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

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

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

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

func (o *GetCarupdatesstatusesOK) GetPayload() *models.HandlersCarUpdateStatuses {
	return o.Payload
}

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

	o.Payload = new(models.HandlersCarUpdateStatuses)

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

	return nil
}

// NewGetCarupdatesstatusesBadRequest creates a GetCarupdatesstatusesBadRequest with default headers values
func NewGetCarupdatesstatusesBadRequest() *GetCarupdatesstatusesBadRequest {
	return &GetCarupdatesstatusesBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarupdatesstatusesUnauthorized creates a GetCarupdatesstatusesUnauthorized with default headers values
func NewGetCarupdatesstatusesUnauthorized() *GetCarupdatesstatusesUnauthorized {
	return &GetCarupdatesstatusesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarupdatesstatusesServiceUnavailable creates a GetCarupdatesstatusesServiceUnavailable with default headers values
func NewGetCarupdatesstatusesServiceUnavailable() *GetCarupdatesstatusesServiceUnavailable {
	return &GetCarupdatesstatusesServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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