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

// PostSubscriptionfeatureReader is a Reader for the PostSubscriptionfeature structure.
type PostSubscriptionfeatureReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostSubscriptionfeatureReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostSubscriptionfeatureOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostSubscriptionfeatureBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostSubscriptionfeatureUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostSubscriptionfeatureServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /subscriptionfeature] PostSubscriptionfeature", response, response.Code())
	}
}

// NewPostSubscriptionfeatureOK creates a PostSubscriptionfeatureOK with default headers values
func NewPostSubscriptionfeatureOK() *PostSubscriptionfeatureOK {
	return &PostSubscriptionfeatureOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSubscriptionfeatureBadRequest creates a PostSubscriptionfeatureBadRequest with default headers values
func NewPostSubscriptionfeatureBadRequest() *PostSubscriptionfeatureBadRequest {
	return &PostSubscriptionfeatureBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSubscriptionfeatureUnauthorized creates a PostSubscriptionfeatureUnauthorized with default headers values
func NewPostSubscriptionfeatureUnauthorized() *PostSubscriptionfeatureUnauthorized {
	return &PostSubscriptionfeatureUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSubscriptionfeatureServiceUnavailable creates a PostSubscriptionfeatureServiceUnavailable with default headers values
func NewPostSubscriptionfeatureServiceUnavailable() *PostSubscriptionfeatureServiceUnavailable {
	return &PostSubscriptionfeatureServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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