// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package assets

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// DeleteAssetReader is a Reader for the DeleteAsset structure.
type DeleteAssetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteAssetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewDeleteAssetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewDeleteAssetForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewDeleteAssetNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewDeleteAssetUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewDeleteAssetInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /assets] deleteAsset", response, response.Code())
	}
}

// NewDeleteAssetOK creates a DeleteAssetOK with default headers values
func NewDeleteAssetOK() *DeleteAssetOK {
	return &DeleteAssetOK{}
}

// DeleteAssetOK describes a response with status code 200, with default header values.
//
// Response with Message Objects with Delete Status
type DeleteAssetOK struct {
	AccessControlAllowOrigin string

	Payload *crm_models.DeleteResponse
}

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

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

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

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

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

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

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

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

func (o *DeleteAssetOK) GetPayload() *crm_models.DeleteResponse {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.DeleteResponse)

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

	return nil
}

// NewDeleteAssetUnauthorized creates a DeleteAssetUnauthorized with default headers values
func NewDeleteAssetUnauthorized() *DeleteAssetUnauthorized {
	return &DeleteAssetUnauthorized{}
}

// DeleteAssetUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type DeleteAssetUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

func (o *DeleteAssetUnauthorized) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewDeleteAssetForbidden creates a DeleteAssetForbidden with default headers values
func NewDeleteAssetForbidden() *DeleteAssetForbidden {
	return &DeleteAssetForbidden{}
}

// DeleteAssetForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type DeleteAssetForbidden struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

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

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

// IsClientError returns true when this delete asset forbidden response has a 4xx status code
func (o *DeleteAssetForbidden) IsClientError() bool {
	return true
}

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

// IsCode returns true when this delete asset forbidden response a status code equal to that given
func (o *DeleteAssetForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the delete asset forbidden response
func (o *DeleteAssetForbidden) Code() int {
	return 403
}

func (o *DeleteAssetForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %s", 403, payload)
}

func (o *DeleteAssetForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %s", 403, payload)
}

func (o *DeleteAssetForbidden) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewDeleteAssetNotFound creates a DeleteAssetNotFound with default headers values
func NewDeleteAssetNotFound() *DeleteAssetNotFound {
	return &DeleteAssetNotFound{}
}

// DeleteAssetNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type DeleteAssetNotFound struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this delete asset not found response has a 2xx status code
func (o *DeleteAssetNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this delete asset not found response has a 3xx status code
func (o *DeleteAssetNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this delete asset not found response has a 4xx status code
func (o *DeleteAssetNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this delete asset not found response has a 5xx status code
func (o *DeleteAssetNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this delete asset not found response a status code equal to that given
func (o *DeleteAssetNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the delete asset not found response
func (o *DeleteAssetNotFound) Code() int {
	return 404
}

func (o *DeleteAssetNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %s", 404, payload)
}

func (o *DeleteAssetNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %s", 404, payload)
}

func (o *DeleteAssetNotFound) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewDeleteAssetUnprocessableEntity creates a DeleteAssetUnprocessableEntity with default headers values
func NewDeleteAssetUnprocessableEntity() *DeleteAssetUnprocessableEntity {
	return &DeleteAssetUnprocessableEntity{}
}

// DeleteAssetUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type DeleteAssetUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this delete asset unprocessable entity response has a 2xx status code
func (o *DeleteAssetUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this delete asset unprocessable entity response has a 3xx status code
func (o *DeleteAssetUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this delete asset unprocessable entity response has a 4xx status code
func (o *DeleteAssetUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this delete asset unprocessable entity response has a 5xx status code
func (o *DeleteAssetUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this delete asset unprocessable entity response a status code equal to that given
func (o *DeleteAssetUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the delete asset unprocessable entity response
func (o *DeleteAssetUnprocessableEntity) Code() int {
	return 422
}

func (o *DeleteAssetUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %s", 422, payload)
}

func (o *DeleteAssetUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %s", 422, payload)
}

func (o *DeleteAssetUnprocessableEntity) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewDeleteAssetInternalServerError creates a DeleteAssetInternalServerError with default headers values
func NewDeleteAssetInternalServerError() *DeleteAssetInternalServerError {
	return &DeleteAssetInternalServerError{}
}

// DeleteAssetInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type DeleteAssetInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this delete asset internal server error response has a 2xx status code
func (o *DeleteAssetInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this delete asset internal server error response has a 3xx status code
func (o *DeleteAssetInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this delete asset internal server error response has a 4xx status code
func (o *DeleteAssetInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this delete asset internal server error response has a 5xx status code
func (o *DeleteAssetInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this delete asset internal server error response a status code equal to that given
func (o *DeleteAssetInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the delete asset internal server error response
func (o *DeleteAssetInternalServerError) Code() int {
	return 500
}

func (o *DeleteAssetInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %s", 500, payload)
}

func (o *DeleteAssetInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %s", 500, payload)
}

func (o *DeleteAssetInternalServerError) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}
