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

// PostSalesTransactionsReader is a Reader for the PostSalesTransactions structure.
type PostSalesTransactionsReader struct {
	formats strfmt.Registry
}

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

// NewPostSalesTransactionsOK creates a PostSalesTransactionsOK with default headers values
func NewPostSalesTransactionsOK() *PostSalesTransactionsOK {
	return &PostSalesTransactionsOK{}
}

/*PostSalesTransactionsOK handles this case with default header values.

An array of Sales Transaction records with the new IDs
*/
type PostSalesTransactionsOK struct {
	Payload *metrc_gw_models.TransactionResponse
}

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

func (o *PostSalesTransactionsOK) GetPayload() *metrc_gw_models.TransactionResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.TransactionResponse)

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

	return nil
}

// NewPostSalesTransactionsUnauthorized creates a PostSalesTransactionsUnauthorized with default headers values
func NewPostSalesTransactionsUnauthorized() *PostSalesTransactionsUnauthorized {
	return &PostSalesTransactionsUnauthorized{}
}

/*PostSalesTransactionsUnauthorized handles this case with default header values.

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

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

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

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

// NewPostSalesTransactionsForbidden creates a PostSalesTransactionsForbidden with default headers values
func NewPostSalesTransactionsForbidden() *PostSalesTransactionsForbidden {
	return &PostSalesTransactionsForbidden{}
}

/*PostSalesTransactionsForbidden handles this case with default header values.

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

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

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

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

// NewPostSalesTransactionsNotFound creates a PostSalesTransactionsNotFound with default headers values
func NewPostSalesTransactionsNotFound() *PostSalesTransactionsNotFound {
	return &PostSalesTransactionsNotFound{}
}

/*PostSalesTransactionsNotFound handles this case with default header values.

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

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

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

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

// NewPostSalesTransactionsInternalServerError creates a PostSalesTransactionsInternalServerError with default headers values
func NewPostSalesTransactionsInternalServerError() *PostSalesTransactionsInternalServerError {
	return &PostSalesTransactionsInternalServerError{}
}

/*PostSalesTransactionsInternalServerError handles this case with default header values.

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

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

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

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