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

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

// DeleteObservationReader is a Reader for the DeleteObservation structure.
type DeleteObservationReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteObservationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteObservationOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewDeleteObservationUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewDeleteObservationForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewDeleteObservationNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewDeleteObservationUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewDeleteObservationInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /observations] deleteObservation", response, response.Code())
	}
}

// NewDeleteObservationOK creates a DeleteObservationOK with default headers values
func NewDeleteObservationOK() *DeleteObservationOK {
	return &DeleteObservationOK{}
}

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

	Payload *research_models.DeleteResponse
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteObservationUnauthorized creates a DeleteObservationUnauthorized with default headers values
func NewDeleteObservationUnauthorized() *DeleteObservationUnauthorized {
	return &DeleteObservationUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteObservationForbidden creates a DeleteObservationForbidden with default headers values
func NewDeleteObservationForbidden() *DeleteObservationForbidden {
	return &DeleteObservationForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteObservationNotFound creates a DeleteObservationNotFound with default headers values
func NewDeleteObservationNotFound() *DeleteObservationNotFound {
	return &DeleteObservationNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteObservationUnprocessableEntity creates a DeleteObservationUnprocessableEntity with default headers values
func NewDeleteObservationUnprocessableEntity() *DeleteObservationUnprocessableEntity {
	return &DeleteObservationUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteObservationInternalServerError creates a DeleteObservationInternalServerError with default headers values
func NewDeleteObservationInternalServerError() *DeleteObservationInternalServerError {
	return &DeleteObservationInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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