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

// 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/metrc-gw/metrc_gw_models"
)

// PostSalesReceiptsReader is a Reader for the PostSalesReceipts structure.
type PostSalesReceiptsReader struct {
	formats strfmt.Registry
}

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

// NewPostSalesReceiptsOK creates a PostSalesReceiptsOK with default headers values
func NewPostSalesReceiptsOK() *PostSalesReceiptsOK {
	return &PostSalesReceiptsOK{}
}

/*PostSalesReceiptsOK handles this case with default header values.

An array of Sales Receipt records with the new IDs
*/
type PostSalesReceiptsOK struct {
	Payload *metrc_gw_models.SalesReceiptResponse
}

func (o *PostSalesReceiptsOK) Error() string {
	return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsOK  %+v", 200, o.Payload)
}

func (o *PostSalesReceiptsOK) GetPayload() *metrc_gw_models.SalesReceiptResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.SalesReceiptResponse)

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

	return nil
}

// NewPostSalesReceiptsUnauthorized creates a PostSalesReceiptsUnauthorized with default headers values
func NewPostSalesReceiptsUnauthorized() *PostSalesReceiptsUnauthorized {
	return &PostSalesReceiptsUnauthorized{}
}

/*PostSalesReceiptsUnauthorized handles this case with default header values.

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

func (o *PostSalesReceiptsUnauthorized) Error() string {
	return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsUnauthorized  %+v", 401, o.Payload)
}

func (o *PostSalesReceiptsUnauthorized) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}

// NewPostSalesReceiptsForbidden creates a PostSalesReceiptsForbidden with default headers values
func NewPostSalesReceiptsForbidden() *PostSalesReceiptsForbidden {
	return &PostSalesReceiptsForbidden{}
}

/*PostSalesReceiptsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PostSalesReceiptsForbidden struct {
	Payload *metrc_gw_models.Error
}

func (o *PostSalesReceiptsForbidden) Error() string {
	return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsForbidden  %+v", 403, o.Payload)
}

func (o *PostSalesReceiptsForbidden) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}

// NewPostSalesReceiptsNotFound creates a PostSalesReceiptsNotFound with default headers values
func NewPostSalesReceiptsNotFound() *PostSalesReceiptsNotFound {
	return &PostSalesReceiptsNotFound{}
}

/*PostSalesReceiptsNotFound handles this case with default header values.

Resource was not found
*/
type PostSalesReceiptsNotFound struct {
	Payload *metrc_gw_models.Error
}

func (o *PostSalesReceiptsNotFound) Error() string {
	return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsNotFound  %+v", 404, o.Payload)
}

func (o *PostSalesReceiptsNotFound) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}

// NewPostSalesReceiptsInternalServerError creates a PostSalesReceiptsInternalServerError with default headers values
func NewPostSalesReceiptsInternalServerError() *PostSalesReceiptsInternalServerError {
	return &PostSalesReceiptsInternalServerError{}
}

/*PostSalesReceiptsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostSalesReceiptsInternalServerError struct {
	Payload *metrc_gw_models.Error
}

func (o *PostSalesReceiptsInternalServerError) Error() string {
	return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsInternalServerError  %+v", 500, o.Payload)
}

func (o *PostSalesReceiptsInternalServerError) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}
