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

// PutSubscriptionconfigReader is a Reader for the PutSubscriptionconfig structure.
type PutSubscriptionconfigReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutSubscriptionconfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutSubscriptionconfigOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutSubscriptionconfigBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutSubscriptionconfigUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutSubscriptionconfigServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /subscriptionconfig] PutSubscriptionconfig", response, response.Code())
	}
}

// NewPutSubscriptionconfigOK creates a PutSubscriptionconfigOK with default headers values
func NewPutSubscriptionconfigOK() *PutSubscriptionconfigOK {
	return &PutSubscriptionconfigOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionconfigBadRequest creates a PutSubscriptionconfigBadRequest with default headers values
func NewPutSubscriptionconfigBadRequest() *PutSubscriptionconfigBadRequest {
	return &PutSubscriptionconfigBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionconfigUnauthorized creates a PutSubscriptionconfigUnauthorized with default headers values
func NewPutSubscriptionconfigUnauthorized() *PutSubscriptionconfigUnauthorized {
	return &PutSubscriptionconfigUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutSubscriptionconfigServiceUnavailable creates a PutSubscriptionconfigServiceUnavailable with default headers values
func NewPutSubscriptionconfigServiceUnavailable() *PutSubscriptionconfigServiceUnavailable {
	return &PutSubscriptionconfigServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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