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

// PostCarsconnectedReader is a Reader for the PostCarsconnected structure.
type PostCarsconnectedReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCarsconnectedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCarsconnectedOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostCarsconnectedBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostCarsconnectedUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostCarsconnectedServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /carsconnected] PostCarsconnected", response, response.Code())
	}
}

// NewPostCarsconnectedOK creates a PostCarsconnectedOK with default headers values
func NewPostCarsconnectedOK() *PostCarsconnectedOK {
	return &PostCarsconnectedOK{}
}

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

Car update statuses
*/
type PostCarsconnectedOK struct {
	Payload map[string]bool
}

// IsSuccess returns true when this post carsconnected o k response has a 2xx status code
func (o *PostCarsconnectedOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the post carsconnected o k response
func (o *PostCarsconnectedOK) Code() int {
	return 200
}

func (o *PostCarsconnectedOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedOK %s", 200, payload)
}

func (o *PostCarsconnectedOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedOK %s", 200, payload)
}

func (o *PostCarsconnectedOK) GetPayload() map[string]bool {
	return o.Payload
}

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

// NewPostCarsconnectedBadRequest creates a PostCarsconnectedBadRequest with default headers values
func NewPostCarsconnectedBadRequest() *PostCarsconnectedBadRequest {
	return &PostCarsconnectedBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post carsconnected bad request response
func (o *PostCarsconnectedBadRequest) Code() int {
	return 400
}

func (o *PostCarsconnectedBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedBadRequest %s", 400, payload)
}

func (o *PostCarsconnectedBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedBadRequest %s", 400, payload)
}

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

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

// NewPostCarsconnectedUnauthorized creates a PostCarsconnectedUnauthorized with default headers values
func NewPostCarsconnectedUnauthorized() *PostCarsconnectedUnauthorized {
	return &PostCarsconnectedUnauthorized{}
}

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

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

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

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

// IsClientError returns true when this post carsconnected unauthorized response has a 4xx status code
func (o *PostCarsconnectedUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the post carsconnected unauthorized response
func (o *PostCarsconnectedUnauthorized) Code() int {
	return 401
}

func (o *PostCarsconnectedUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedUnauthorized %s", 401, payload)
}

func (o *PostCarsconnectedUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedUnauthorized %s", 401, payload)
}

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

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

// NewPostCarsconnectedServiceUnavailable creates a PostCarsconnectedServiceUnavailable with default headers values
func NewPostCarsconnectedServiceUnavailable() *PostCarsconnectedServiceUnavailable {
	return &PostCarsconnectedServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post carsconnected service unavailable response
func (o *PostCarsconnectedServiceUnavailable) Code() int {
	return 503
}

func (o *PostCarsconnectedServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedServiceUnavailable %s", 503, payload)
}

func (o *PostCarsconnectedServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carsconnected][%d] postCarsconnectedServiceUnavailable %s", 503, payload)
}

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

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