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

// GetVehiclemodelsReader is a Reader for the GetVehiclemodels structure.
type GetVehiclemodelsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetVehiclemodelsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetVehiclemodelsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetVehiclemodelsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetVehiclemodelsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetVehiclemodelsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /vehiclemodels] GetVehiclemodels", response, response.Code())
	}
}

// NewGetVehiclemodelsOK creates a GetVehiclemodelsOK with default headers values
func NewGetVehiclemodelsOK() *GetVehiclemodelsOK {
	return &GetVehiclemodelsOK{}
}

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

OK
*/
type GetVehiclemodelsOK struct {
	Payload *models.HandlersJSONModelsResult
}

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

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

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

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

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

// Code gets the status code for the get vehiclemodels o k response
func (o *GetVehiclemodelsOK) Code() int {
	return 200
}

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

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

func (o *GetVehiclemodelsOK) GetPayload() *models.HandlersJSONModelsResult {
	return o.Payload
}

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

	o.Payload = new(models.HandlersJSONModelsResult)

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

	return nil
}

// NewGetVehiclemodelsBadRequest creates a GetVehiclemodelsBadRequest with default headers values
func NewGetVehiclemodelsBadRequest() *GetVehiclemodelsBadRequest {
	return &GetVehiclemodelsBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get vehiclemodels bad request response
func (o *GetVehiclemodelsBadRequest) Code() int {
	return 400
}

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

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

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

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

// NewGetVehiclemodelsUnauthorized creates a GetVehiclemodelsUnauthorized with default headers values
func NewGetVehiclemodelsUnauthorized() *GetVehiclemodelsUnauthorized {
	return &GetVehiclemodelsUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get vehiclemodels unauthorized response
func (o *GetVehiclemodelsUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewGetVehiclemodelsServiceUnavailable creates a GetVehiclemodelsServiceUnavailable with default headers values
func NewGetVehiclemodelsServiceUnavailable() *GetVehiclemodelsServiceUnavailable {
	return &GetVehiclemodelsServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get vehiclemodels service unavailable response
func (o *GetVehiclemodelsServiceUnavailable) Code() int {
	return 503
}

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

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

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

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