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

// GetFlashpackVersionsModelTrimYearReader is a Reader for the GetFlashpackVersionsModelTrimYear structure.
type GetFlashpackVersionsModelTrimYearReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFlashpackVersionsModelTrimYearReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetFlashpackVersionsModelTrimYearOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetFlashpackVersionsModelTrimYearBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetFlashpackVersionsModelTrimYearUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetFlashpackVersionsModelTrimYearServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /flashpack_versions/{model}/{trim}/{year}] GetFlashpackVersionsModelTrimYear", response, response.Code())
	}
}

// NewGetFlashpackVersionsModelTrimYearOK creates a GetFlashpackVersionsModelTrimYearOK with default headers values
func NewGetFlashpackVersionsModelTrimYearOK() *GetFlashpackVersionsModelTrimYearOK {
	return &GetFlashpackVersionsModelTrimYearOK{}
}

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

Get flashpacks result
*/
type GetFlashpackVersionsModelTrimYearOK struct {
	Payload *models.CommonJSONDBQueryResult
}

// IsSuccess returns true when this get flashpack versions model trim year o k response has a 2xx status code
func (o *GetFlashpackVersionsModelTrimYearOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get flashpack versions model trim year o k response has a 3xx status code
func (o *GetFlashpackVersionsModelTrimYearOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get flashpack versions model trim year o k response has a 4xx status code
func (o *GetFlashpackVersionsModelTrimYearOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get flashpack versions model trim year o k response has a 5xx status code
func (o *GetFlashpackVersionsModelTrimYearOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get flashpack versions model trim year o k response a status code equal to that given
func (o *GetFlashpackVersionsModelTrimYearOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get flashpack versions model trim year o k response
func (o *GetFlashpackVersionsModelTrimYearOK) Code() int {
	return 200
}

func (o *GetFlashpackVersionsModelTrimYearOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearOK %s", 200, payload)
}

func (o *GetFlashpackVersionsModelTrimYearOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearOK %s", 200, payload)
}

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

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

// NewGetFlashpackVersionsModelTrimYearBadRequest creates a GetFlashpackVersionsModelTrimYearBadRequest with default headers values
func NewGetFlashpackVersionsModelTrimYearBadRequest() *GetFlashpackVersionsModelTrimYearBadRequest {
	return &GetFlashpackVersionsModelTrimYearBadRequest{}
}

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

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

// IsSuccess returns true when this get flashpack versions model trim year bad request response has a 2xx status code
func (o *GetFlashpackVersionsModelTrimYearBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get flashpack versions model trim year bad request response has a 3xx status code
func (o *GetFlashpackVersionsModelTrimYearBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get flashpack versions model trim year bad request response has a 4xx status code
func (o *GetFlashpackVersionsModelTrimYearBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get flashpack versions model trim year bad request response has a 5xx status code
func (o *GetFlashpackVersionsModelTrimYearBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this get flashpack versions model trim year bad request response a status code equal to that given
func (o *GetFlashpackVersionsModelTrimYearBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the get flashpack versions model trim year bad request response
func (o *GetFlashpackVersionsModelTrimYearBadRequest) Code() int {
	return 400
}

func (o *GetFlashpackVersionsModelTrimYearBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearBadRequest %s", 400, payload)
}

func (o *GetFlashpackVersionsModelTrimYearBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearBadRequest %s", 400, payload)
}

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

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

// NewGetFlashpackVersionsModelTrimYearUnauthorized creates a GetFlashpackVersionsModelTrimYearUnauthorized with default headers values
func NewGetFlashpackVersionsModelTrimYearUnauthorized() *GetFlashpackVersionsModelTrimYearUnauthorized {
	return &GetFlashpackVersionsModelTrimYearUnauthorized{}
}

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

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

// IsSuccess returns true when this get flashpack versions model trim year unauthorized response has a 2xx status code
func (o *GetFlashpackVersionsModelTrimYearUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get flashpack versions model trim year unauthorized response has a 3xx status code
func (o *GetFlashpackVersionsModelTrimYearUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get flashpack versions model trim year unauthorized response has a 4xx status code
func (o *GetFlashpackVersionsModelTrimYearUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get flashpack versions model trim year unauthorized response has a 5xx status code
func (o *GetFlashpackVersionsModelTrimYearUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get flashpack versions model trim year unauthorized response a status code equal to that given
func (o *GetFlashpackVersionsModelTrimYearUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get flashpack versions model trim year unauthorized response
func (o *GetFlashpackVersionsModelTrimYearUnauthorized) Code() int {
	return 401
}

func (o *GetFlashpackVersionsModelTrimYearUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearUnauthorized %s", 401, payload)
}

func (o *GetFlashpackVersionsModelTrimYearUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearUnauthorized %s", 401, payload)
}

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

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

// NewGetFlashpackVersionsModelTrimYearServiceUnavailable creates a GetFlashpackVersionsModelTrimYearServiceUnavailable with default headers values
func NewGetFlashpackVersionsModelTrimYearServiceUnavailable() *GetFlashpackVersionsModelTrimYearServiceUnavailable {
	return &GetFlashpackVersionsModelTrimYearServiceUnavailable{}
}

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

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

// IsSuccess returns true when this get flashpack versions model trim year service unavailable response has a 2xx status code
func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get flashpack versions model trim year service unavailable response has a 3xx status code
func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get flashpack versions model trim year service unavailable response has a 4xx status code
func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this get flashpack versions model trim year service unavailable response has a 5xx status code
func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this get flashpack versions model trim year service unavailable response a status code equal to that given
func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

// Code gets the status code for the get flashpack versions model trim year service unavailable response
func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) Code() int {
	return 503
}

func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearServiceUnavailable %s", 503, payload)
}

func (o *GetFlashpackVersionsModelTrimYearServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /flashpack_versions/{model}/{trim}/{year}][%d] getFlashpackVersionsModelTrimYearServiceUnavailable %s", 503, payload)
}

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

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