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

// PutSalesDeliveriesReader is a Reader for the PutSalesDeliveries structure.
type PutSalesDeliveriesReader struct {
	formats strfmt.Registry
}

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

// NewPutSalesDeliveriesOK creates a PutSalesDeliveriesOK with default headers values
func NewPutSalesDeliveriesOK() *PutSalesDeliveriesOK {
	return &PutSalesDeliveriesOK{}
}

/*PutSalesDeliveriesOK handles this case with default header values.

An array of Sales Delivery records with the new IDs
*/
type PutSalesDeliveriesOK struct {
	Payload *metrc_gw_models.SalesDeliveryResponse
}

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

func (o *PutSalesDeliveriesOK) GetPayload() *metrc_gw_models.SalesDeliveryResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.SalesDeliveryResponse)

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

	return nil
}

// NewPutSalesDeliveriesUnauthorized creates a PutSalesDeliveriesUnauthorized with default headers values
func NewPutSalesDeliveriesUnauthorized() *PutSalesDeliveriesUnauthorized {
	return &PutSalesDeliveriesUnauthorized{}
}

/*PutSalesDeliveriesUnauthorized handles this case with default header values.

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

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

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

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

// NewPutSalesDeliveriesForbidden creates a PutSalesDeliveriesForbidden with default headers values
func NewPutSalesDeliveriesForbidden() *PutSalesDeliveriesForbidden {
	return &PutSalesDeliveriesForbidden{}
}

/*PutSalesDeliveriesForbidden handles this case with default header values.

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

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

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

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

// NewPutSalesDeliveriesNotFound creates a PutSalesDeliveriesNotFound with default headers values
func NewPutSalesDeliveriesNotFound() *PutSalesDeliveriesNotFound {
	return &PutSalesDeliveriesNotFound{}
}

/*PutSalesDeliveriesNotFound handles this case with default header values.

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

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

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

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

// NewPutSalesDeliveriesInternalServerError creates a PutSalesDeliveriesInternalServerError with default headers values
func NewPutSalesDeliveriesInternalServerError() *PutSalesDeliveriesInternalServerError {
	return &PutSalesDeliveriesInternalServerError{}
}

/*PutSalesDeliveriesInternalServerError handles this case with default header values.

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

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

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

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