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

// PutVehicleVinReader is a Reader for the PutVehicleVin structure.
type PutVehicleVinReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutVehicleVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutVehicleVinOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutVehicleVinBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutVehicleVinUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutVehicleVinServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /vehicle/{vin}] PutVehicleVin", response, response.Code())
	}
}

// NewPutVehicleVinOK creates a PutVehicleVinOK with default headers values
func NewPutVehicleVinOK() *PutVehicleVinOK {
	return &PutVehicleVinOK{}
}

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

OK
*/
type PutVehicleVinOK struct {
	Payload *models.CommonUpdateCarRequest
}

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

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

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

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

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

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

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

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

func (o *PutVehicleVinOK) GetPayload() *models.CommonUpdateCarRequest {
	return o.Payload
}

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

	o.Payload = new(models.CommonUpdateCarRequest)

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

	return nil
}

// NewPutVehicleVinBadRequest creates a PutVehicleVinBadRequest with default headers values
func NewPutVehicleVinBadRequest() *PutVehicleVinBadRequest {
	return &PutVehicleVinBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutVehicleVinUnauthorized creates a PutVehicleVinUnauthorized with default headers values
func NewPutVehicleVinUnauthorized() *PutVehicleVinUnauthorized {
	return &PutVehicleVinUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutVehicleVinServiceUnavailable creates a PutVehicleVinServiceUnavailable with default headers values
func NewPutVehicleVinServiceUnavailable() *PutVehicleVinServiceUnavailable {
	return &PutVehicleVinServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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