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

// DeleteSubscriptionpackageReader is a Reader for the DeleteSubscriptionpackage structure.
type DeleteSubscriptionpackageReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteSubscriptionpackageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteSubscriptionpackageOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewDeleteSubscriptionpackageBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewDeleteSubscriptionpackageUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewDeleteSubscriptionpackageServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /subscriptionpackage] DeleteSubscriptionpackage", response, response.Code())
	}
}

// NewDeleteSubscriptionpackageOK creates a DeleteSubscriptionpackageOK with default headers values
func NewDeleteSubscriptionpackageOK() *DeleteSubscriptionpackageOK {
	return &DeleteSubscriptionpackageOK{}
}

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

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

// IsSuccess returns true when this delete subscriptionpackage o k response has a 2xx status code
func (o *DeleteSubscriptionpackageOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the delete subscriptionpackage o k response
func (o *DeleteSubscriptionpackageOK) Code() int {
	return 200
}

func (o *DeleteSubscriptionpackageOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageOK %s", 200, payload)
}

func (o *DeleteSubscriptionpackageOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageOK %s", 200, payload)
}

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

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

// NewDeleteSubscriptionpackageBadRequest creates a DeleteSubscriptionpackageBadRequest with default headers values
func NewDeleteSubscriptionpackageBadRequest() *DeleteSubscriptionpackageBadRequest {
	return &DeleteSubscriptionpackageBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the delete subscriptionpackage bad request response
func (o *DeleteSubscriptionpackageBadRequest) Code() int {
	return 400
}

func (o *DeleteSubscriptionpackageBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageBadRequest %s", 400, payload)
}

func (o *DeleteSubscriptionpackageBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageBadRequest %s", 400, payload)
}

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

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

// NewDeleteSubscriptionpackageUnauthorized creates a DeleteSubscriptionpackageUnauthorized with default headers values
func NewDeleteSubscriptionpackageUnauthorized() *DeleteSubscriptionpackageUnauthorized {
	return &DeleteSubscriptionpackageUnauthorized{}
}

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

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

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

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

// IsClientError returns true when this delete subscriptionpackage unauthorized response has a 4xx status code
func (o *DeleteSubscriptionpackageUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the delete subscriptionpackage unauthorized response
func (o *DeleteSubscriptionpackageUnauthorized) Code() int {
	return 401
}

func (o *DeleteSubscriptionpackageUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageUnauthorized %s", 401, payload)
}

func (o *DeleteSubscriptionpackageUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageUnauthorized %s", 401, payload)
}

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

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

// NewDeleteSubscriptionpackageServiceUnavailable creates a DeleteSubscriptionpackageServiceUnavailable with default headers values
func NewDeleteSubscriptionpackageServiceUnavailable() *DeleteSubscriptionpackageServiceUnavailable {
	return &DeleteSubscriptionpackageServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the delete subscriptionpackage service unavailable response
func (o *DeleteSubscriptionpackageServiceUnavailable) Code() int {
	return 503
}

func (o *DeleteSubscriptionpackageServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageServiceUnavailable %s", 503, payload)
}

func (o *DeleteSubscriptionpackageServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /subscriptionpackage][%d] deleteSubscriptionpackageServiceUnavailable %s", 503, payload)
}

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

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