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

// GetCarupdateslogReader is a Reader for the GetCarupdateslog structure.
type GetCarupdateslogReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCarupdateslogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCarupdateslogOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetCarupdateslogBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetCarupdateslogUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetCarupdateslogServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /carupdateslog] GetCarupdateslog", response, response.Code())
	}
}

// NewGetCarupdateslogOK creates a GetCarupdateslogOK with default headers values
func NewGetCarupdateslogOK() *GetCarupdateslogOK {
	return &GetCarupdateslogOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarupdateslogBadRequest creates a GetCarupdateslogBadRequest with default headers values
func NewGetCarupdateslogBadRequest() *GetCarupdateslogBadRequest {
	return &GetCarupdateslogBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarupdateslogUnauthorized creates a GetCarupdateslogUnauthorized with default headers values
func NewGetCarupdateslogUnauthorized() *GetCarupdateslogUnauthorized {
	return &GetCarupdateslogUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarupdateslogServiceUnavailable creates a GetCarupdateslogServiceUnavailable with default headers values
func NewGetCarupdateslogServiceUnavailable() *GetCarupdateslogServiceUnavailable {
	return &GetCarupdateslogServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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