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

// 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/sf-gate/sf_gate_models"
)

// PostCashReceiptsReader is a Reader for the PostCashReceipts structure.
type PostCashReceiptsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCashReceiptsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCashReceiptsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCashReceiptsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCashReceiptsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCashReceiptsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCashReceiptsInternalServerError()
		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())
	}
}

// NewPostCashReceiptsOK creates a PostCashReceiptsOK with default headers values
func NewPostCashReceiptsOK() *PostCashReceiptsOK {
	return &PostCashReceiptsOK{}
}

/*PostCashReceiptsOK handles this case with default header values.

Taxnexus Response with Cash Receipt objects
*/
type PostCashReceiptsOK struct {
	Payload *sf_gate_models.CashReceiptResponse
}

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

func (o *PostCashReceiptsOK) GetPayload() *sf_gate_models.CashReceiptResponse {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.CashReceiptResponse)

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

	return nil
}

// NewPostCashReceiptsUnauthorized creates a PostCashReceiptsUnauthorized with default headers values
func NewPostCashReceiptsUnauthorized() *PostCashReceiptsUnauthorized {
	return &PostCashReceiptsUnauthorized{}
}

/*PostCashReceiptsUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PostCashReceiptsUnauthorized struct {
	Payload *sf_gate_models.Error
}

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

func (o *PostCashReceiptsUnauthorized) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewPostCashReceiptsForbidden creates a PostCashReceiptsForbidden with default headers values
func NewPostCashReceiptsForbidden() *PostCashReceiptsForbidden {
	return &PostCashReceiptsForbidden{}
}

/*PostCashReceiptsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PostCashReceiptsForbidden struct {
	Payload *sf_gate_models.Error
}

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

func (o *PostCashReceiptsForbidden) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewPostCashReceiptsNotFound creates a PostCashReceiptsNotFound with default headers values
func NewPostCashReceiptsNotFound() *PostCashReceiptsNotFound {
	return &PostCashReceiptsNotFound{}
}

/*PostCashReceiptsNotFound handles this case with default header values.

Resource was not found
*/
type PostCashReceiptsNotFound struct {
	Payload *sf_gate_models.Error
}

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

func (o *PostCashReceiptsNotFound) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewPostCashReceiptsInternalServerError creates a PostCashReceiptsInternalServerError with default headers values
func NewPostCashReceiptsInternalServerError() *PostCashReceiptsInternalServerError {
	return &PostCashReceiptsInternalServerError{}
}

/*PostCashReceiptsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostCashReceiptsInternalServerError struct {
	Payload *sf_gate_models.Error
}

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

func (o *PostCashReceiptsInternalServerError) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}
