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

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

package cash_receipt

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/taxnexus/go/lib/api/ops/ops_models"
)

// PutCashReceiptsReader is a Reader for the PutCashReceipts structure.
type PutCashReceiptsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutCashReceiptsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutCashReceiptsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutCashReceiptsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutCashReceiptsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutCashReceiptsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutCashReceiptsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutCashReceiptsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewPutCashReceiptsOK creates a PutCashReceiptsOK with default headers values
func NewPutCashReceiptsOK() *PutCashReceiptsOK {
	return &PutCashReceiptsOK{}
}

/*PutCashReceiptsOK handles this case with default header values.

Taxnexus Response with Cash Receipt objects
*/
type PutCashReceiptsOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *ops_models.CashReceiptResponse
}

func (o *PutCashReceiptsOK) Error() string {
	return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsOK  %+v", 200, o.Payload)
}

func (o *PutCashReceiptsOK) GetPayload() *ops_models.CashReceiptResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(ops_models.CashReceiptResponse)

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

	return nil
}

// NewPutCashReceiptsUnauthorized creates a PutCashReceiptsUnauthorized with default headers values
func NewPutCashReceiptsUnauthorized() *PutCashReceiptsUnauthorized {
	return &PutCashReceiptsUnauthorized{}
}

/*PutCashReceiptsUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PutCashReceiptsUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutCashReceiptsUnauthorized) Error() string {
	return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsUnauthorized  %+v", 401, o.Payload)
}

func (o *PutCashReceiptsUnauthorized) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutCashReceiptsForbidden creates a PutCashReceiptsForbidden with default headers values
func NewPutCashReceiptsForbidden() *PutCashReceiptsForbidden {
	return &PutCashReceiptsForbidden{}
}

/*PutCashReceiptsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PutCashReceiptsForbidden struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutCashReceiptsForbidden) Error() string {
	return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsForbidden  %+v", 403, o.Payload)
}

func (o *PutCashReceiptsForbidden) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutCashReceiptsNotFound creates a PutCashReceiptsNotFound with default headers values
func NewPutCashReceiptsNotFound() *PutCashReceiptsNotFound {
	return &PutCashReceiptsNotFound{}
}

/*PutCashReceiptsNotFound handles this case with default header values.

Resource was not found
*/
type PutCashReceiptsNotFound struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutCashReceiptsNotFound) Error() string {
	return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsNotFound  %+v", 404, o.Payload)
}

func (o *PutCashReceiptsNotFound) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutCashReceiptsUnprocessableEntity creates a PutCashReceiptsUnprocessableEntity with default headers values
func NewPutCashReceiptsUnprocessableEntity() *PutCashReceiptsUnprocessableEntity {
	return &PutCashReceiptsUnprocessableEntity{}
}

/*PutCashReceiptsUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PutCashReceiptsUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutCashReceiptsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PutCashReceiptsUnprocessableEntity) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutCashReceiptsInternalServerError creates a PutCashReceiptsInternalServerError with default headers values
func NewPutCashReceiptsInternalServerError() *PutCashReceiptsInternalServerError {
	return &PutCashReceiptsInternalServerError{}
}

/*PutCashReceiptsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PutCashReceiptsInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutCashReceiptsInternalServerError) Error() string {
	return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsInternalServerError  %+v", 500, o.Payload)
}

func (o *PutCashReceiptsInternalServerError) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}
