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

// PutSubscriptionfeatureReader is a Reader for the PutSubscriptionfeature structure.
type PutSubscriptionfeatureReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutSubscriptionfeatureReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutSubscriptionfeatureOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutSubscriptionfeatureBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutSubscriptionfeatureUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutSubscriptionfeatureServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /subscriptionfeature] PutSubscriptionfeature", response, response.Code())
	}
}

// NewPutSubscriptionfeatureOK creates a PutSubscriptionfeatureOK with default headers values
func NewPutSubscriptionfeatureOK() *PutSubscriptionfeatureOK {
	return &PutSubscriptionfeatureOK{}
}

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

OK
*/
type PutSubscriptionfeatureOK struct {
	Payload *models.CommonSubscriptionFeature
}

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

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

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

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

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

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

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

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

func (o *PutSubscriptionfeatureOK) GetPayload() *models.CommonSubscriptionFeature {
	return o.Payload
}

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

	o.Payload = new(models.CommonSubscriptionFeature)

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

	return nil
}

// NewPutSubscriptionfeatureBadRequest creates a PutSubscriptionfeatureBadRequest with default headers values
func NewPutSubscriptionfeatureBadRequest() *PutSubscriptionfeatureBadRequest {
	return &PutSubscriptionfeatureBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionfeatureUnauthorized creates a PutSubscriptionfeatureUnauthorized with default headers values
func NewPutSubscriptionfeatureUnauthorized() *PutSubscriptionfeatureUnauthorized {
	return &PutSubscriptionfeatureUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionfeatureServiceUnavailable creates a PutSubscriptionfeatureServiceUnavailable with default headers values
func NewPutSubscriptionfeatureServiceUnavailable() *PutSubscriptionfeatureServiceUnavailable {
	return &PutSubscriptionfeatureServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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