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

// PostCarupdateIDDeployReader is a Reader for the PostCarupdateIDDeploy structure.
type PostCarupdateIDDeployReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCarupdateIDDeployReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCarupdateIDDeployOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostCarupdateIDDeployBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostCarupdateIDDeployUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostCarupdateIDDeployServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /carupdate/{id}/deploy] PostCarupdateIDDeploy", response, response.Code())
	}
}

// NewPostCarupdateIDDeployOK creates a PostCarupdateIDDeployOK with default headers values
func NewPostCarupdateIDDeployOK() *PostCarupdateIDDeployOK {
	return &PostCarupdateIDDeployOK{}
}

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

Request result
*/
type PostCarupdateIDDeployOK struct {
	Payload *models.CommonJSONMessage
}

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

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

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

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

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

// Code gets the status code for the post carupdate Id deploy o k response
func (o *PostCarupdateIDDeployOK) Code() int {
	return 200
}

func (o *PostCarupdateIDDeployOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployOK %s", 200, payload)
}

func (o *PostCarupdateIDDeployOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployOK %s", 200, payload)
}

func (o *PostCarupdateIDDeployOK) GetPayload() *models.CommonJSONMessage {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONMessage)

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

	return nil
}

// NewPostCarupdateIDDeployBadRequest creates a PostCarupdateIDDeployBadRequest with default headers values
func NewPostCarupdateIDDeployBadRequest() *PostCarupdateIDDeployBadRequest {
	return &PostCarupdateIDDeployBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post carupdate Id deploy bad request response
func (o *PostCarupdateIDDeployBadRequest) Code() int {
	return 400
}

func (o *PostCarupdateIDDeployBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployBadRequest %s", 400, payload)
}

func (o *PostCarupdateIDDeployBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployBadRequest %s", 400, payload)
}

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

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

// NewPostCarupdateIDDeployUnauthorized creates a PostCarupdateIDDeployUnauthorized with default headers values
func NewPostCarupdateIDDeployUnauthorized() *PostCarupdateIDDeployUnauthorized {
	return &PostCarupdateIDDeployUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post carupdate Id deploy unauthorized response
func (o *PostCarupdateIDDeployUnauthorized) Code() int {
	return 401
}

func (o *PostCarupdateIDDeployUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployUnauthorized %s", 401, payload)
}

func (o *PostCarupdateIDDeployUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployUnauthorized %s", 401, payload)
}

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

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

// NewPostCarupdateIDDeployServiceUnavailable creates a PostCarupdateIDDeployServiceUnavailable with default headers values
func NewPostCarupdateIDDeployServiceUnavailable() *PostCarupdateIDDeployServiceUnavailable {
	return &PostCarupdateIDDeployServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post carupdate Id deploy service unavailable response
func (o *PostCarupdateIDDeployServiceUnavailable) Code() int {
	return 503
}

func (o *PostCarupdateIDDeployServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployServiceUnavailable %s", 503, payload)
}

func (o *PostCarupdateIDDeployServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /carupdate/{id}/deploy][%d] postCarupdateIdDeployServiceUnavailable %s", 503, payload)
}

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

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