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

// PostVehiclecommandImmobilizeReader is a Reader for the PostVehiclecommandImmobilize structure.
type PostVehiclecommandImmobilizeReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostVehiclecommandImmobilizeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostVehiclecommandImmobilizeOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostVehiclecommandImmobilizeBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostVehiclecommandImmobilizeUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostVehiclecommandImmobilizeServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /vehiclecommand/immobilize] PostVehiclecommandImmobilize", response, response.Code())
	}
}

// NewPostVehiclecommandImmobilizeOK creates a PostVehiclecommandImmobilizeOK with default headers values
func NewPostVehiclecommandImmobilizeOK() *PostVehiclecommandImmobilizeOK {
	return &PostVehiclecommandImmobilizeOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclecommandImmobilizeBadRequest creates a PostVehiclecommandImmobilizeBadRequest with default headers values
func NewPostVehiclecommandImmobilizeBadRequest() *PostVehiclecommandImmobilizeBadRequest {
	return &PostVehiclecommandImmobilizeBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclecommandImmobilizeUnauthorized creates a PostVehiclecommandImmobilizeUnauthorized with default headers values
func NewPostVehiclecommandImmobilizeUnauthorized() *PostVehiclecommandImmobilizeUnauthorized {
	return &PostVehiclecommandImmobilizeUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclecommandImmobilizeServiceUnavailable creates a PostVehiclecommandImmobilizeServiceUnavailable with default headers values
func NewPostVehiclecommandImmobilizeServiceUnavailable() *PostVehiclecommandImmobilizeServiceUnavailable {
	return &PostVehiclecommandImmobilizeServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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