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

// DeleteFlashpackVersionReader is a Reader for the DeleteFlashpackVersion structure.
type DeleteFlashpackVersionReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteFlashpackVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteFlashpackVersionOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewDeleteFlashpackVersionBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewDeleteFlashpackVersionUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewDeleteFlashpackVersionServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /flashpack_version] DeleteFlashpackVersion", response, response.Code())
	}
}

// NewDeleteFlashpackVersionOK creates a DeleteFlashpackVersionOK with default headers values
func NewDeleteFlashpackVersionOK() *DeleteFlashpackVersionOK {
	return &DeleteFlashpackVersionOK{}
}

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

Deleted flashpack ecu mapping result
*/
type DeleteFlashpackVersionOK struct {
	Payload *models.CommonJSONDBQueryResult
}

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

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

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

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

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

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

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

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

func (o *DeleteFlashpackVersionOK) GetPayload() *models.CommonJSONDBQueryResult {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONDBQueryResult)

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

	return nil
}

// NewDeleteFlashpackVersionBadRequest creates a DeleteFlashpackVersionBadRequest with default headers values
func NewDeleteFlashpackVersionBadRequest() *DeleteFlashpackVersionBadRequest {
	return &DeleteFlashpackVersionBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteFlashpackVersionUnauthorized creates a DeleteFlashpackVersionUnauthorized with default headers values
func NewDeleteFlashpackVersionUnauthorized() *DeleteFlashpackVersionUnauthorized {
	return &DeleteFlashpackVersionUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewDeleteFlashpackVersionServiceUnavailable creates a DeleteFlashpackVersionServiceUnavailable with default headers values
func NewDeleteFlashpackVersionServiceUnavailable() *DeleteFlashpackVersionServiceUnavailable {
	return &DeleteFlashpackVersionServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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