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

// GetSalesTransactionsReader is a Reader for the GetSalesTransactions structure.
type GetSalesTransactionsReader struct {
	formats strfmt.Registry
}

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

// NewGetSalesTransactionsOK creates a GetSalesTransactionsOK with default headers values
func NewGetSalesTransactionsOK() *GetSalesTransactionsOK {
	return &GetSalesTransactionsOK{}
}

/*GetSalesTransactionsOK handles this case with default header values.

A list of active Sales Receipts was succefully retrieved
*/
type GetSalesTransactionsOK struct {
	Payload *metrc_gw_models.TransactionResponse
}

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

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

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

// NewGetSalesTransactionsUnauthorized creates a GetSalesTransactionsUnauthorized with default headers values
func NewGetSalesTransactionsUnauthorized() *GetSalesTransactionsUnauthorized {
	return &GetSalesTransactionsUnauthorized{}
}

/*GetSalesTransactionsUnauthorized handles this case with default header values.

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

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

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

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

// NewGetSalesTransactionsForbidden creates a GetSalesTransactionsForbidden with default headers values
func NewGetSalesTransactionsForbidden() *GetSalesTransactionsForbidden {
	return &GetSalesTransactionsForbidden{}
}

/*GetSalesTransactionsForbidden handles this case with default header values.

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

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

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

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

// NewGetSalesTransactionsNotFound creates a GetSalesTransactionsNotFound with default headers values
func NewGetSalesTransactionsNotFound() *GetSalesTransactionsNotFound {
	return &GetSalesTransactionsNotFound{}
}

/*GetSalesTransactionsNotFound handles this case with default header values.

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

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

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

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

// NewGetSalesTransactionsInternalServerError creates a GetSalesTransactionsInternalServerError with default headers values
func NewGetSalesTransactionsInternalServerError() *GetSalesTransactionsInternalServerError {
	return &GetSalesTransactionsInternalServerError{}
}

/*GetSalesTransactionsInternalServerError handles this case with default header values.

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

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

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

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