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

// PutSalesTransactionsReader is a Reader for the PutSalesTransactions structure.
type PutSalesTransactionsReader struct {
	formats strfmt.Registry
}

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

// NewPutSalesTransactionsOK creates a PutSalesTransactionsOK with default headers values
func NewPutSalesTransactionsOK() *PutSalesTransactionsOK {
	return &PutSalesTransactionsOK{}
}

/*PutSalesTransactionsOK handles this case with default header values.

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

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

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

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

// NewPutSalesTransactionsUnauthorized creates a PutSalesTransactionsUnauthorized with default headers values
func NewPutSalesTransactionsUnauthorized() *PutSalesTransactionsUnauthorized {
	return &PutSalesTransactionsUnauthorized{}
}

/*PutSalesTransactionsUnauthorized handles this case with default header values.

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

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

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

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

// NewPutSalesTransactionsForbidden creates a PutSalesTransactionsForbidden with default headers values
func NewPutSalesTransactionsForbidden() *PutSalesTransactionsForbidden {
	return &PutSalesTransactionsForbidden{}
}

/*PutSalesTransactionsForbidden handles this case with default header values.

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

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

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

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

// NewPutSalesTransactionsNotFound creates a PutSalesTransactionsNotFound with default headers values
func NewPutSalesTransactionsNotFound() *PutSalesTransactionsNotFound {
	return &PutSalesTransactionsNotFound{}
}

/*PutSalesTransactionsNotFound handles this case with default header values.

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

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

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

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

// NewPutSalesTransactionsInternalServerError creates a PutSalesTransactionsInternalServerError with default headers values
func NewPutSalesTransactionsInternalServerError() *PutSalesTransactionsInternalServerError {
	return &PutSalesTransactionsInternalServerError{}
}

/*PutSalesTransactionsInternalServerError handles this case with default header values.

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

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

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

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