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

// PutSubscriptionpackageReader is a Reader for the PutSubscriptionpackage structure.
type PutSubscriptionpackageReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutSubscriptionpackageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutSubscriptionpackageOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutSubscriptionpackageBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutSubscriptionpackageUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutSubscriptionpackageServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /subscriptionpackage] PutSubscriptionpackage", response, response.Code())
	}
}

// NewPutSubscriptionpackageOK creates a PutSubscriptionpackageOK with default headers values
func NewPutSubscriptionpackageOK() *PutSubscriptionpackageOK {
	return &PutSubscriptionpackageOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionpackageBadRequest creates a PutSubscriptionpackageBadRequest with default headers values
func NewPutSubscriptionpackageBadRequest() *PutSubscriptionpackageBadRequest {
	return &PutSubscriptionpackageBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionpackageUnauthorized creates a PutSubscriptionpackageUnauthorized with default headers values
func NewPutSubscriptionpackageUnauthorized() *PutSubscriptionpackageUnauthorized {
	return &PutSubscriptionpackageUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionpackageServiceUnavailable creates a PutSubscriptionpackageServiceUnavailable with default headers values
func NewPutSubscriptionpackageServiceUnavailable() *PutSubscriptionpackageServiceUnavailable {
	return &PutSubscriptionpackageServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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