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

// PostSubscriptionpackagefeatureReader is a Reader for the PostSubscriptionpackagefeature structure.
type PostSubscriptionpackagefeatureReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostSubscriptionpackagefeatureReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostSubscriptionpackagefeatureOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostSubscriptionpackagefeatureBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostSubscriptionpackagefeatureUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostSubscriptionpackagefeatureServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /subscriptionpackagefeature] PostSubscriptionpackagefeature", response, response.Code())
	}
}

// NewPostSubscriptionpackagefeatureOK creates a PostSubscriptionpackagefeatureOK with default headers values
func NewPostSubscriptionpackagefeatureOK() *PostSubscriptionpackagefeatureOK {
	return &PostSubscriptionpackagefeatureOK{}
}

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

OK
*/
type PostSubscriptionpackagefeatureOK struct {
	Payload *models.CommonJSONMessage
}

// IsSuccess returns true when this post subscriptionpackagefeature o k response has a 2xx status code
func (o *PostSubscriptionpackagefeatureOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the post subscriptionpackagefeature o k response
func (o *PostSubscriptionpackagefeatureOK) Code() int {
	return 200
}

func (o *PostSubscriptionpackagefeatureOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureOK %s", 200, payload)
}

func (o *PostSubscriptionpackagefeatureOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureOK %s", 200, payload)
}

func (o *PostSubscriptionpackagefeatureOK) GetPayload() *models.CommonJSONMessage {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONMessage)

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

	return nil
}

// NewPostSubscriptionpackagefeatureBadRequest creates a PostSubscriptionpackagefeatureBadRequest with default headers values
func NewPostSubscriptionpackagefeatureBadRequest() *PostSubscriptionpackagefeatureBadRequest {
	return &PostSubscriptionpackagefeatureBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post subscriptionpackagefeature bad request response
func (o *PostSubscriptionpackagefeatureBadRequest) Code() int {
	return 400
}

func (o *PostSubscriptionpackagefeatureBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureBadRequest %s", 400, payload)
}

func (o *PostSubscriptionpackagefeatureBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureBadRequest %s", 400, payload)
}

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

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

// NewPostSubscriptionpackagefeatureUnauthorized creates a PostSubscriptionpackagefeatureUnauthorized with default headers values
func NewPostSubscriptionpackagefeatureUnauthorized() *PostSubscriptionpackagefeatureUnauthorized {
	return &PostSubscriptionpackagefeatureUnauthorized{}
}

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

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

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

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

// IsClientError returns true when this post subscriptionpackagefeature unauthorized response has a 4xx status code
func (o *PostSubscriptionpackagefeatureUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the post subscriptionpackagefeature unauthorized response
func (o *PostSubscriptionpackagefeatureUnauthorized) Code() int {
	return 401
}

func (o *PostSubscriptionpackagefeatureUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureUnauthorized %s", 401, payload)
}

func (o *PostSubscriptionpackagefeatureUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureUnauthorized %s", 401, payload)
}

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

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

// NewPostSubscriptionpackagefeatureServiceUnavailable creates a PostSubscriptionpackagefeatureServiceUnavailable with default headers values
func NewPostSubscriptionpackagefeatureServiceUnavailable() *PostSubscriptionpackagefeatureServiceUnavailable {
	return &PostSubscriptionpackagefeatureServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post subscriptionpackagefeature service unavailable response
func (o *PostSubscriptionpackagefeatureServiceUnavailable) Code() int {
	return 503
}

func (o *PostSubscriptionpackagefeatureServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureServiceUnavailable %s", 503, payload)
}

func (o *PostSubscriptionpackagefeatureServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /subscriptionpackagefeature][%d] postSubscriptionpackagefeatureServiceUnavailable %s", 503, payload)
}

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

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