// 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 factors

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

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

// DeleteFactorReader is a Reader for the DeleteFactor structure.
type DeleteFactorReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteFactorReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteFactorOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewDeleteFactorUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewDeleteFactorForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewDeleteFactorNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewDeleteFactorUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewDeleteFactorInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /factors] deleteFactor", response, response.Code())
	}
}

// NewDeleteFactorOK creates a DeleteFactorOK with default headers values
func NewDeleteFactorOK() *DeleteFactorOK {
	return &DeleteFactorOK{}
}

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

	Payload *research_models.DeleteResponse
}

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

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

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

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

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

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

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

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

func (o *DeleteFactorOK) GetPayload() *research_models.DeleteResponse {
	return o.Payload
}

func (o *DeleteFactorOK) 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(research_models.DeleteResponse)

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

	return nil
}

// NewDeleteFactorUnauthorized creates a DeleteFactorUnauthorized with default headers values
func NewDeleteFactorUnauthorized() *DeleteFactorUnauthorized {
	return &DeleteFactorUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *DeleteFactorUnauthorized) GetPayload() *research_models.Error {
	return o.Payload
}

func (o *DeleteFactorUnauthorized) 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(research_models.Error)

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

	return nil
}

// NewDeleteFactorForbidden creates a DeleteFactorForbidden with default headers values
func NewDeleteFactorForbidden() *DeleteFactorForbidden {
	return &DeleteFactorForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *DeleteFactorForbidden) GetPayload() *research_models.Error {
	return o.Payload
}

func (o *DeleteFactorForbidden) 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(research_models.Error)

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

	return nil
}

// NewDeleteFactorNotFound creates a DeleteFactorNotFound with default headers values
func NewDeleteFactorNotFound() *DeleteFactorNotFound {
	return &DeleteFactorNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *DeleteFactorNotFound) GetPayload() *research_models.Error {
	return o.Payload
}

func (o *DeleteFactorNotFound) 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(research_models.Error)

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

	return nil
}

// NewDeleteFactorUnprocessableEntity creates a DeleteFactorUnprocessableEntity with default headers values
func NewDeleteFactorUnprocessableEntity() *DeleteFactorUnprocessableEntity {
	return &DeleteFactorUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *DeleteFactorUnprocessableEntity) GetPayload() *research_models.Error {
	return o.Payload
}

func (o *DeleteFactorUnprocessableEntity) 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(research_models.Error)

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

	return nil
}

// NewDeleteFactorInternalServerError creates a DeleteFactorInternalServerError with default headers values
func NewDeleteFactorInternalServerError() *DeleteFactorInternalServerError {
	return &DeleteFactorInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *DeleteFactorInternalServerError) GetPayload() *research_models.Error {
	return o.Payload
}

func (o *DeleteFactorInternalServerError) 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(research_models.Error)

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

	return nil
}
