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

// PostCarstateMultiReader is a Reader for the PostCarstateMulti structure.
type PostCarstateMultiReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCarstateMultiReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCarstateMultiOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostCarstateMultiBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostCarstateMultiUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostCarstateMultiServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /carstate_multi] PostCarstateMulti", response, response.Code())
	}
}

// NewPostCarstateMultiOK creates a PostCarstateMultiOK with default headers values
func NewPostCarstateMultiOK() *PostCarstateMultiOK {
	return &PostCarstateMultiOK{}
}

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

OK
*/
type PostCarstateMultiOK struct {
	Payload *models.HandlersJSONCarStateMultiMessage
}

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

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

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

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

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

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

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

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

func (o *PostCarstateMultiOK) GetPayload() *models.HandlersJSONCarStateMultiMessage {
	return o.Payload
}

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

	o.Payload = new(models.HandlersJSONCarStateMultiMessage)

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

	return nil
}

// NewPostCarstateMultiBadRequest creates a PostCarstateMultiBadRequest with default headers values
func NewPostCarstateMultiBadRequest() *PostCarstateMultiBadRequest {
	return &PostCarstateMultiBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostCarstateMultiUnauthorized creates a PostCarstateMultiUnauthorized with default headers values
func NewPostCarstateMultiUnauthorized() *PostCarstateMultiUnauthorized {
	return &PostCarstateMultiUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostCarstateMultiServiceUnavailable creates a PostCarstateMultiServiceUnavailable with default headers values
func NewPostCarstateMultiServiceUnavailable() *PostCarstateMultiServiceUnavailable {
	return &PostCarstateMultiServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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