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

// GetCarConfigVinReader is a Reader for the GetCarConfigVin structure.
type GetCarConfigVinReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCarConfigVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCarConfigVinOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetCarConfigVinBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetCarConfigVinUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetCarConfigVinServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /car_config/{vin}] GetCarConfigVin", response, response.Code())
	}
}

// NewGetCarConfigVinOK creates a GetCarConfigVinOK with default headers values
func NewGetCarConfigVinOK() *GetCarConfigVinOK {
	return &GetCarConfigVinOK{}
}

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

OK
*/
type GetCarConfigVinOK struct {
	Payload *models.CommonUpdateConfigManifest
}

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

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

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

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

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

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

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

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

func (o *GetCarConfigVinOK) GetPayload() *models.CommonUpdateConfigManifest {
	return o.Payload
}

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

	o.Payload = new(models.CommonUpdateConfigManifest)

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

	return nil
}

// NewGetCarConfigVinBadRequest creates a GetCarConfigVinBadRequest with default headers values
func NewGetCarConfigVinBadRequest() *GetCarConfigVinBadRequest {
	return &GetCarConfigVinBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarConfigVinUnauthorized creates a GetCarConfigVinUnauthorized with default headers values
func NewGetCarConfigVinUnauthorized() *GetCarConfigVinUnauthorized {
	return &GetCarConfigVinUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCarConfigVinServiceUnavailable creates a GetCarConfigVinServiceUnavailable with default headers values
func NewGetCarConfigVinServiceUnavailable() *GetCarConfigVinServiceUnavailable {
	return &GetCarConfigVinServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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