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

// GetVehicleVinFleetsReader is a Reader for the GetVehicleVinFleets structure.
type GetVehicleVinFleetsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetVehicleVinFleetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetVehicleVinFleetsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetVehicleVinFleetsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetVehicleVinFleetsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetVehicleVinFleetsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /vehicle/{vin}/fleets] GetVehicleVinFleets", response, response.Code())
	}
}

// NewGetVehicleVinFleetsOK creates a GetVehicleVinFleetsOK with default headers values
func NewGetVehicleVinFleetsOK() *GetVehicleVinFleetsOK {
	return &GetVehicleVinFleetsOK{}
}

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

OK
*/
type GetVehicleVinFleetsOK struct {
	Payload *models.CommonJSONDBQueryResult
}

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

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

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

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

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

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

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

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

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

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

// NewGetVehicleVinFleetsBadRequest creates a GetVehicleVinFleetsBadRequest with default headers values
func NewGetVehicleVinFleetsBadRequest() *GetVehicleVinFleetsBadRequest {
	return &GetVehicleVinFleetsBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetVehicleVinFleetsUnauthorized creates a GetVehicleVinFleetsUnauthorized with default headers values
func NewGetVehicleVinFleetsUnauthorized() *GetVehicleVinFleetsUnauthorized {
	return &GetVehicleVinFleetsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetVehicleVinFleetsServiceUnavailable creates a GetVehicleVinFleetsServiceUnavailable with default headers values
func NewGetVehicleVinFleetsServiceUnavailable() *GetVehicleVinFleetsServiceUnavailable {
	return &GetVehicleVinFleetsServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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