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

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

// DeleteContractReader is a Reader for the DeleteContract structure.
type DeleteContractReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewDeleteContractOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewDeleteContractUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewDeleteContractForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewDeleteContractNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewDeleteContractUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewDeleteContractInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /contracts] deleteContract", response, response.Code())
	}
}

// NewDeleteContractOK creates a DeleteContractOK with default headers values
func NewDeleteContractOK() *DeleteContractOK {
	return &DeleteContractOK{}
}

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

	Payload *crm_models.DeleteResponse
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteContractUnauthorized creates a DeleteContractUnauthorized with default headers values
func NewDeleteContractUnauthorized() *DeleteContractUnauthorized {
	return &DeleteContractUnauthorized{}
}

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

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteContractForbidden creates a DeleteContractForbidden with default headers values
func NewDeleteContractForbidden() *DeleteContractForbidden {
	return &DeleteContractForbidden{}
}

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

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteContractNotFound creates a DeleteContractNotFound with default headers values
func NewDeleteContractNotFound() *DeleteContractNotFound {
	return &DeleteContractNotFound{}
}

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

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteContractUnprocessableEntity creates a DeleteContractUnprocessableEntity with default headers values
func NewDeleteContractUnprocessableEntity() *DeleteContractUnprocessableEntity {
	return &DeleteContractUnprocessableEntity{}
}

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

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewDeleteContractInternalServerError creates a DeleteContractInternalServerError with default headers values
func NewDeleteContractInternalServerError() *DeleteContractInternalServerError {
	return &DeleteContractInternalServerError{}
}

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

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

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

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