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

// DeleteCarupdateReader is a Reader for the DeleteCarupdate structure.
type DeleteCarupdateReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteCarupdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteCarupdateOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewDeleteCarupdateBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewDeleteCarupdateUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewDeleteCarupdateServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /carupdate] DeleteCarupdate", response, response.Code())
	}
}

// NewDeleteCarupdateOK creates a DeleteCarupdateOK with default headers values
func NewDeleteCarupdateOK() *DeleteCarupdateOK {
	return &DeleteCarupdateOK{}
}

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

OK
*/
type DeleteCarupdateOK struct {
	Payload *models.CommonJSONMessage
}

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

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

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

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

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

// Code gets the status code for the delete carupdate o k response
func (o *DeleteCarupdateOK) Code() int {
	return 200
}

func (o *DeleteCarupdateOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateOK %s", 200, payload)
}

func (o *DeleteCarupdateOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateOK %s", 200, payload)
}

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

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

// NewDeleteCarupdateBadRequest creates a DeleteCarupdateBadRequest with default headers values
func NewDeleteCarupdateBadRequest() *DeleteCarupdateBadRequest {
	return &DeleteCarupdateBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the delete carupdate bad request response
func (o *DeleteCarupdateBadRequest) Code() int {
	return 400
}

func (o *DeleteCarupdateBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateBadRequest %s", 400, payload)
}

func (o *DeleteCarupdateBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateBadRequest %s", 400, payload)
}

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

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

// NewDeleteCarupdateUnauthorized creates a DeleteCarupdateUnauthorized with default headers values
func NewDeleteCarupdateUnauthorized() *DeleteCarupdateUnauthorized {
	return &DeleteCarupdateUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the delete carupdate unauthorized response
func (o *DeleteCarupdateUnauthorized) Code() int {
	return 401
}

func (o *DeleteCarupdateUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateUnauthorized %s", 401, payload)
}

func (o *DeleteCarupdateUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateUnauthorized %s", 401, payload)
}

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

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

// NewDeleteCarupdateServiceUnavailable creates a DeleteCarupdateServiceUnavailable with default headers values
func NewDeleteCarupdateServiceUnavailable() *DeleteCarupdateServiceUnavailable {
	return &DeleteCarupdateServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the delete carupdate service unavailable response
func (o *DeleteCarupdateServiceUnavailable) Code() int {
	return 503
}

func (o *DeleteCarupdateServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateServiceUnavailable %s", 503, payload)
}

func (o *DeleteCarupdateServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /carupdate][%d] deleteCarupdateServiceUnavailable %s", 503, payload)
}

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

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