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

// GetVehicleVinReader is a Reader for the GetVehicleVin structure.
type GetVehicleVinReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetVehicleVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetVehicleVinOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetVehicleVinBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetVehicleVinUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetVehicleVinServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /vehicle/{vin}] GetVehicleVin", response, response.Code())
	}
}

// NewGetVehicleVinOK creates a GetVehicleVinOK with default headers values
func NewGetVehicleVinOK() *GetVehicleVinOK {
	return &GetVehicleVinOK{}
}

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

OK
*/
type GetVehicleVinOK struct {
	Payload *models.MongoVehicle
}

// IsSuccess returns true when this get vehicle vin o k response has a 2xx status code
func (o *GetVehicleVinOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get vehicle vin o k response has a 3xx status code
func (o *GetVehicleVinOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get vehicle vin o k response has a 4xx status code
func (o *GetVehicleVinOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get vehicle vin o k response has a 5xx status code
func (o *GetVehicleVinOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get vehicle vin o k response a status code equal to that given
func (o *GetVehicleVinOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get vehicle vin o k response
func (o *GetVehicleVinOK) Code() int {
	return 200
}

func (o *GetVehicleVinOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinOK %s", 200, payload)
}

func (o *GetVehicleVinOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinOK %s", 200, payload)
}

func (o *GetVehicleVinOK) GetPayload() *models.MongoVehicle {
	return o.Payload
}

func (o *GetVehicleVinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.MongoVehicle)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetVehicleVinBadRequest creates a GetVehicleVinBadRequest with default headers values
func NewGetVehicleVinBadRequest() *GetVehicleVinBadRequest {
	return &GetVehicleVinBadRequest{}
}

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

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

// IsSuccess returns true when this get vehicle vin bad request response has a 2xx status code
func (o *GetVehicleVinBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get vehicle vin bad request response has a 3xx status code
func (o *GetVehicleVinBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get vehicle vin bad request response has a 4xx status code
func (o *GetVehicleVinBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get vehicle vin bad request response has a 5xx status code
func (o *GetVehicleVinBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the get vehicle vin bad request response
func (o *GetVehicleVinBadRequest) Code() int {
	return 400
}

func (o *GetVehicleVinBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinBadRequest %s", 400, payload)
}

func (o *GetVehicleVinBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinBadRequest %s", 400, payload)
}

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

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

// NewGetVehicleVinUnauthorized creates a GetVehicleVinUnauthorized with default headers values
func NewGetVehicleVinUnauthorized() *GetVehicleVinUnauthorized {
	return &GetVehicleVinUnauthorized{}
}

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

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

// IsSuccess returns true when this get vehicle vin unauthorized response has a 2xx status code
func (o *GetVehicleVinUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get vehicle vin unauthorized response has a 3xx status code
func (o *GetVehicleVinUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get vehicle vin unauthorized response has a 4xx status code
func (o *GetVehicleVinUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get vehicle vin unauthorized response has a 5xx status code
func (o *GetVehicleVinUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get vehicle vin unauthorized response a status code equal to that given
func (o *GetVehicleVinUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get vehicle vin unauthorized response
func (o *GetVehicleVinUnauthorized) Code() int {
	return 401
}

func (o *GetVehicleVinUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinUnauthorized %s", 401, payload)
}

func (o *GetVehicleVinUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinUnauthorized %s", 401, payload)
}

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

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

// NewGetVehicleVinServiceUnavailable creates a GetVehicleVinServiceUnavailable with default headers values
func NewGetVehicleVinServiceUnavailable() *GetVehicleVinServiceUnavailable {
	return &GetVehicleVinServiceUnavailable{}
}

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

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

// IsSuccess returns true when this get vehicle vin service unavailable response has a 2xx status code
func (o *GetVehicleVinServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get vehicle vin service unavailable response has a 3xx status code
func (o *GetVehicleVinServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get vehicle vin service unavailable response has a 4xx status code
func (o *GetVehicleVinServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this get vehicle vin service unavailable response has a 5xx status code
func (o *GetVehicleVinServiceUnavailable) IsServerError() bool {
	return true
}

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

// Code gets the status code for the get vehicle vin service unavailable response
func (o *GetVehicleVinServiceUnavailable) Code() int {
	return 503
}

func (o *GetVehicleVinServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinServiceUnavailable %s", 503, payload)
}

func (o *GetVehicleVinServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /vehicle/{vin}][%d] getVehicleVinServiceUnavailable %s", 503, payload)
}

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

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