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

// PostSalesDeliveriesReader is a Reader for the PostSalesDeliveries structure.
type PostSalesDeliveriesReader struct {
	formats strfmt.Registry
}

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

// NewPostSalesDeliveriesOK creates a PostSalesDeliveriesOK with default headers values
func NewPostSalesDeliveriesOK() *PostSalesDeliveriesOK {
	return &PostSalesDeliveriesOK{}
}

/*PostSalesDeliveriesOK handles this case with default header values.

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

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

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

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

// NewPostSalesDeliveriesUnauthorized creates a PostSalesDeliveriesUnauthorized with default headers values
func NewPostSalesDeliveriesUnauthorized() *PostSalesDeliveriesUnauthorized {
	return &PostSalesDeliveriesUnauthorized{}
}

/*PostSalesDeliveriesUnauthorized handles this case with default header values.

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

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

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

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

// NewPostSalesDeliveriesForbidden creates a PostSalesDeliveriesForbidden with default headers values
func NewPostSalesDeliveriesForbidden() *PostSalesDeliveriesForbidden {
	return &PostSalesDeliveriesForbidden{}
}

/*PostSalesDeliveriesForbidden handles this case with default header values.

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

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

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

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

// NewPostSalesDeliveriesNotFound creates a PostSalesDeliveriesNotFound with default headers values
func NewPostSalesDeliveriesNotFound() *PostSalesDeliveriesNotFound {
	return &PostSalesDeliveriesNotFound{}
}

/*PostSalesDeliveriesNotFound handles this case with default header values.

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

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

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

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

// NewPostSalesDeliveriesInternalServerError creates a PostSalesDeliveriesInternalServerError with default headers values
func NewPostSalesDeliveriesInternalServerError() *PostSalesDeliveriesInternalServerError {
	return &PostSalesDeliveriesInternalServerError{}
}

/*PostSalesDeliveriesInternalServerError handles this case with default header values.

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

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

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

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