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

// PostVehiclecommandReader is a Reader for the PostVehiclecommand structure.
type PostVehiclecommandReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostVehiclecommandReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostVehiclecommandOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostVehiclecommandBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostVehiclecommandUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostVehiclecommandServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /vehiclecommand] PostVehiclecommand", response, response.Code())
	}
}

// NewPostVehiclecommandOK creates a PostVehiclecommandOK with default headers values
func NewPostVehiclecommandOK() *PostVehiclecommandOK {
	return &PostVehiclecommandOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclecommandBadRequest creates a PostVehiclecommandBadRequest with default headers values
func NewPostVehiclecommandBadRequest() *PostVehiclecommandBadRequest {
	return &PostVehiclecommandBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclecommandUnauthorized creates a PostVehiclecommandUnauthorized with default headers values
func NewPostVehiclecommandUnauthorized() *PostVehiclecommandUnauthorized {
	return &PostVehiclecommandUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclecommandServiceUnavailable creates a PostVehiclecommandServiceUnavailable with default headers values
func NewPostVehiclecommandServiceUnavailable() *PostVehiclecommandServiceUnavailable {
	return &PostVehiclecommandServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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