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

// GetFlashpackVersionInfoVinReader is a Reader for the GetFlashpackVersionInfoVin structure.
type GetFlashpackVersionInfoVinReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFlashpackVersionInfoVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetFlashpackVersionInfoVinOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetFlashpackVersionInfoVinBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetFlashpackVersionInfoVinUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetFlashpackVersionInfoVinServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /flashpack_version_info/{vin}] GetFlashpackVersionInfoVin", response, response.Code())
	}
}

// NewGetFlashpackVersionInfoVinOK creates a GetFlashpackVersionInfoVinOK with default headers values
func NewGetFlashpackVersionInfoVinOK() *GetFlashpackVersionInfoVinOK {
	return &GetFlashpackVersionInfoVinOK{}
}

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

Get flashpack version info result
*/
type GetFlashpackVersionInfoVinOK struct {
	Payload *models.CommonJSONDBQueryResult
}

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

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

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

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

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

// Code gets the status code for the get flashpack version info vin o k response
func (o *GetFlashpackVersionInfoVinOK) Code() int {
	return 200
}

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

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

func (o *GetFlashpackVersionInfoVinOK) GetPayload() *models.CommonJSONDBQueryResult {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONDBQueryResult)

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

	return nil
}

// NewGetFlashpackVersionInfoVinBadRequest creates a GetFlashpackVersionInfoVinBadRequest with default headers values
func NewGetFlashpackVersionInfoVinBadRequest() *GetFlashpackVersionInfoVinBadRequest {
	return &GetFlashpackVersionInfoVinBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get flashpack version info vin bad request response
func (o *GetFlashpackVersionInfoVinBadRequest) Code() int {
	return 400
}

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

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

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

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

// NewGetFlashpackVersionInfoVinUnauthorized creates a GetFlashpackVersionInfoVinUnauthorized with default headers values
func NewGetFlashpackVersionInfoVinUnauthorized() *GetFlashpackVersionInfoVinUnauthorized {
	return &GetFlashpackVersionInfoVinUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get flashpack version info vin unauthorized response
func (o *GetFlashpackVersionInfoVinUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewGetFlashpackVersionInfoVinServiceUnavailable creates a GetFlashpackVersionInfoVinServiceUnavailable with default headers values
func NewGetFlashpackVersionInfoVinServiceUnavailable() *GetFlashpackVersionInfoVinServiceUnavailable {
	return &GetFlashpackVersionInfoVinServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get flashpack version info vin service unavailable response
func (o *GetFlashpackVersionInfoVinServiceUnavailable) Code() int {
	return 503
}

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

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

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

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