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

// DeleteApitokenReader is a Reader for the DeleteApitoken structure.
type DeleteApitokenReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteApitokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteApitokenOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewDeleteApitokenBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewDeleteApitokenUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewDeleteApitokenServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /apitoken] DeleteApitoken", response, response.Code())
	}
}

// NewDeleteApitokenOK creates a DeleteApitokenOK with default headers values
func NewDeleteApitokenOK() *DeleteApitokenOK {
	return &DeleteApitokenOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteApitokenBadRequest creates a DeleteApitokenBadRequest with default headers values
func NewDeleteApitokenBadRequest() *DeleteApitokenBadRequest {
	return &DeleteApitokenBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteApitokenUnauthorized creates a DeleteApitokenUnauthorized with default headers values
func NewDeleteApitokenUnauthorized() *DeleteApitokenUnauthorized {
	return &DeleteApitokenUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteApitokenServiceUnavailable creates a DeleteApitokenServiceUnavailable with default headers values
func NewDeleteApitokenServiceUnavailable() *DeleteApitokenServiceUnavailable {
	return &DeleteApitokenServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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