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

// PostVehiclediagnosticcommandReader is a Reader for the PostVehiclediagnosticcommand structure.
type PostVehiclediagnosticcommandReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostVehiclediagnosticcommandReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostVehiclediagnosticcommandOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostVehiclediagnosticcommandBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostVehiclediagnosticcommandUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostVehiclediagnosticcommandServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /vehiclediagnosticcommand] PostVehiclediagnosticcommand", response, response.Code())
	}
}

// NewPostVehiclediagnosticcommandOK creates a PostVehiclediagnosticcommandOK with default headers values
func NewPostVehiclediagnosticcommandOK() *PostVehiclediagnosticcommandOK {
	return &PostVehiclediagnosticcommandOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclediagnosticcommandBadRequest creates a PostVehiclediagnosticcommandBadRequest with default headers values
func NewPostVehiclediagnosticcommandBadRequest() *PostVehiclediagnosticcommandBadRequest {
	return &PostVehiclediagnosticcommandBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclediagnosticcommandUnauthorized creates a PostVehiclediagnosticcommandUnauthorized with default headers values
func NewPostVehiclediagnosticcommandUnauthorized() *PostVehiclediagnosticcommandUnauthorized {
	return &PostVehiclediagnosticcommandUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostVehiclediagnosticcommandServiceUnavailable creates a PostVehiclediagnosticcommandServiceUnavailable with default headers values
func NewPostVehiclediagnosticcommandServiceUnavailable() *PostVehiclediagnosticcommandServiceUnavailable {
	return &PostVehiclediagnosticcommandServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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