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

// GetFleetNameVehiclesReader is a Reader for the GetFleetNameVehicles structure.
type GetFleetNameVehiclesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFleetNameVehiclesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetFleetNameVehiclesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetFleetNameVehiclesBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetFleetNameVehiclesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetFleetNameVehiclesServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /fleet/{name}/vehicles] GetFleetNameVehicles", response, response.Code())
	}
}

// NewGetFleetNameVehiclesOK creates a GetFleetNameVehiclesOK with default headers values
func NewGetFleetNameVehiclesOK() *GetFleetNameVehiclesOK {
	return &GetFleetNameVehiclesOK{}
}

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

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

// IsSuccess returns true when this get fleet name vehicles o k response has a 2xx status code
func (o *GetFleetNameVehiclesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get fleet name vehicles o k response has a 3xx status code
func (o *GetFleetNameVehiclesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get fleet name vehicles o k response has a 4xx status code
func (o *GetFleetNameVehiclesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get fleet name vehicles o k response has a 5xx status code
func (o *GetFleetNameVehiclesOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the get fleet name vehicles o k response
func (o *GetFleetNameVehiclesOK) Code() int {
	return 200
}

func (o *GetFleetNameVehiclesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesOK %s", 200, payload)
}

func (o *GetFleetNameVehiclesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesOK %s", 200, payload)
}

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

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

// NewGetFleetNameVehiclesBadRequest creates a GetFleetNameVehiclesBadRequest with default headers values
func NewGetFleetNameVehiclesBadRequest() *GetFleetNameVehiclesBadRequest {
	return &GetFleetNameVehiclesBadRequest{}
}

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

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

// IsSuccess returns true when this get fleet name vehicles bad request response has a 2xx status code
func (o *GetFleetNameVehiclesBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get fleet name vehicles bad request response has a 3xx status code
func (o *GetFleetNameVehiclesBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get fleet name vehicles bad request response has a 4xx status code
func (o *GetFleetNameVehiclesBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get fleet name vehicles bad request response has a 5xx status code
func (o *GetFleetNameVehiclesBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the get fleet name vehicles bad request response
func (o *GetFleetNameVehiclesBadRequest) Code() int {
	return 400
}

func (o *GetFleetNameVehiclesBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesBadRequest %s", 400, payload)
}

func (o *GetFleetNameVehiclesBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesBadRequest %s", 400, payload)
}

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

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

// NewGetFleetNameVehiclesUnauthorized creates a GetFleetNameVehiclesUnauthorized with default headers values
func NewGetFleetNameVehiclesUnauthorized() *GetFleetNameVehiclesUnauthorized {
	return &GetFleetNameVehiclesUnauthorized{}
}

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

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

// IsSuccess returns true when this get fleet name vehicles unauthorized response has a 2xx status code
func (o *GetFleetNameVehiclesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get fleet name vehicles unauthorized response has a 3xx status code
func (o *GetFleetNameVehiclesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get fleet name vehicles unauthorized response has a 4xx status code
func (o *GetFleetNameVehiclesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get fleet name vehicles unauthorized response has a 5xx status code
func (o *GetFleetNameVehiclesUnauthorized) IsServerError() bool {
	return false
}

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

// Code gets the status code for the get fleet name vehicles unauthorized response
func (o *GetFleetNameVehiclesUnauthorized) Code() int {
	return 401
}

func (o *GetFleetNameVehiclesUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesUnauthorized %s", 401, payload)
}

func (o *GetFleetNameVehiclesUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesUnauthorized %s", 401, payload)
}

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

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

// NewGetFleetNameVehiclesServiceUnavailable creates a GetFleetNameVehiclesServiceUnavailable with default headers values
func NewGetFleetNameVehiclesServiceUnavailable() *GetFleetNameVehiclesServiceUnavailable {
	return &GetFleetNameVehiclesServiceUnavailable{}
}

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

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

// IsSuccess returns true when this get fleet name vehicles service unavailable response has a 2xx status code
func (o *GetFleetNameVehiclesServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get fleet name vehicles service unavailable response has a 3xx status code
func (o *GetFleetNameVehiclesServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get fleet name vehicles service unavailable response has a 4xx status code
func (o *GetFleetNameVehiclesServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this get fleet name vehicles service unavailable response has a 5xx status code
func (o *GetFleetNameVehiclesServiceUnavailable) IsServerError() bool {
	return true
}

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

// Code gets the status code for the get fleet name vehicles service unavailable response
func (o *GetFleetNameVehiclesServiceUnavailable) Code() int {
	return 503
}

func (o *GetFleetNameVehiclesServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesServiceUnavailable %s", 503, payload)
}

func (o *GetFleetNameVehiclesServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}/vehicles][%d] getFleetNameVehiclesServiceUnavailable %s", 503, payload)
}

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

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