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

// PostCarupdateIDVehicleCancelReader is a Reader for the PostCarupdateIDVehicleCancel structure.
type PostCarupdateIDVehicleCancelReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCarupdateIDVehicleCancelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCarupdateIDVehicleCancelOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostCarupdateIDVehicleCancelBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostCarupdateIDVehicleCancelUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostCarupdateIDVehicleCancelServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /carupdate/{id}/vehicle-cancel] PostCarupdateIDVehicleCancel", response, response.Code())
	}
}

// NewPostCarupdateIDVehicleCancelOK creates a PostCarupdateIDVehicleCancelOK with default headers values
func NewPostCarupdateIDVehicleCancelOK() *PostCarupdateIDVehicleCancelOK {
	return &PostCarupdateIDVehicleCancelOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostCarupdateIDVehicleCancelBadRequest creates a PostCarupdateIDVehicleCancelBadRequest with default headers values
func NewPostCarupdateIDVehicleCancelBadRequest() *PostCarupdateIDVehicleCancelBadRequest {
	return &PostCarupdateIDVehicleCancelBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostCarupdateIDVehicleCancelUnauthorized creates a PostCarupdateIDVehicleCancelUnauthorized with default headers values
func NewPostCarupdateIDVehicleCancelUnauthorized() *PostCarupdateIDVehicleCancelUnauthorized {
	return &PostCarupdateIDVehicleCancelUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostCarupdateIDVehicleCancelServiceUnavailable creates a PostCarupdateIDVehicleCancelServiceUnavailable with default headers values
func NewPostCarupdateIDVehicleCancelServiceUnavailable() *PostCarupdateIDVehicleCancelServiceUnavailable {
	return &PostCarupdateIDVehicleCancelServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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