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

// DeleteSubscriptionReader is a Reader for the DeleteSubscription structure.
type DeleteSubscriptionReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteSubscriptionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteSubscriptionOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewDeleteSubscriptionBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewDeleteSubscriptionUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewDeleteSubscriptionServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /subscription] DeleteSubscription", response, response.Code())
	}
}

// NewDeleteSubscriptionOK creates a DeleteSubscriptionOK with default headers values
func NewDeleteSubscriptionOK() *DeleteSubscriptionOK {
	return &DeleteSubscriptionOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteSubscriptionBadRequest creates a DeleteSubscriptionBadRequest with default headers values
func NewDeleteSubscriptionBadRequest() *DeleteSubscriptionBadRequest {
	return &DeleteSubscriptionBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteSubscriptionUnauthorized creates a DeleteSubscriptionUnauthorized with default headers values
func NewDeleteSubscriptionUnauthorized() *DeleteSubscriptionUnauthorized {
	return &DeleteSubscriptionUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteSubscriptionServiceUnavailable creates a DeleteSubscriptionServiceUnavailable with default headers values
func NewDeleteSubscriptionServiceUnavailable() *DeleteSubscriptionServiceUnavailable {
	return &DeleteSubscriptionServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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