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

// GetSubscriptionpackageReader is a Reader for the GetSubscriptionpackage structure.
type GetSubscriptionpackageReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetSubscriptionpackageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetSubscriptionpackageOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetSubscriptionpackageBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetSubscriptionpackageUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetSubscriptionpackageServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /subscriptionpackage] GetSubscriptionpackage", response, response.Code())
	}
}

// NewGetSubscriptionpackageOK creates a GetSubscriptionpackageOK with default headers values
func NewGetSubscriptionpackageOK() *GetSubscriptionpackageOK {
	return &GetSubscriptionpackageOK{}
}

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

OK
*/
type GetSubscriptionpackageOK struct {
	Payload *models.CommonSubscriptionPackage
}

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

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

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

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

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

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

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

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

func (o *GetSubscriptionpackageOK) GetPayload() *models.CommonSubscriptionPackage {
	return o.Payload
}

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

	o.Payload = new(models.CommonSubscriptionPackage)

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

	return nil
}

// NewGetSubscriptionpackageBadRequest creates a GetSubscriptionpackageBadRequest with default headers values
func NewGetSubscriptionpackageBadRequest() *GetSubscriptionpackageBadRequest {
	return &GetSubscriptionpackageBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetSubscriptionpackageUnauthorized creates a GetSubscriptionpackageUnauthorized with default headers values
func NewGetSubscriptionpackageUnauthorized() *GetSubscriptionpackageUnauthorized {
	return &GetSubscriptionpackageUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetSubscriptionpackageServiceUnavailable creates a GetSubscriptionpackageServiceUnavailable with default headers values
func NewGetSubscriptionpackageServiceUnavailable() *GetSubscriptionpackageServiceUnavailable {
	return &GetSubscriptionpackageServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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