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

// PostSubscriptionconfigReader is a Reader for the PostSubscriptionconfig structure.
type PostSubscriptionconfigReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostSubscriptionconfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostSubscriptionconfigOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostSubscriptionconfigBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostSubscriptionconfigUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostSubscriptionconfigServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /subscriptionconfig] PostSubscriptionconfig", response, response.Code())
	}
}

// NewPostSubscriptionconfigOK creates a PostSubscriptionconfigOK with default headers values
func NewPostSubscriptionconfigOK() *PostSubscriptionconfigOK {
	return &PostSubscriptionconfigOK{}
}

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

OK
*/
type PostSubscriptionconfigOK struct {
	Payload *models.CommonSubscriptionConfiguration
}

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

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

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

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

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

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

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

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

func (o *PostSubscriptionconfigOK) GetPayload() *models.CommonSubscriptionConfiguration {
	return o.Payload
}

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

	o.Payload = new(models.CommonSubscriptionConfiguration)

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

	return nil
}

// NewPostSubscriptionconfigBadRequest creates a PostSubscriptionconfigBadRequest with default headers values
func NewPostSubscriptionconfigBadRequest() *PostSubscriptionconfigBadRequest {
	return &PostSubscriptionconfigBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSubscriptionconfigUnauthorized creates a PostSubscriptionconfigUnauthorized with default headers values
func NewPostSubscriptionconfigUnauthorized() *PostSubscriptionconfigUnauthorized {
	return &PostSubscriptionconfigUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSubscriptionconfigServiceUnavailable creates a PostSubscriptionconfigServiceUnavailable with default headers values
func NewPostSubscriptionconfigServiceUnavailable() *PostSubscriptionconfigServiceUnavailable {
	return &PostSubscriptionconfigServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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