// 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 purchase_order

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

// PutPurchaseOrdersReader is a Reader for the PutPurchaseOrders structure.
type PutPurchaseOrdersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutPurchaseOrdersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutPurchaseOrdersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutPurchaseOrdersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutPurchaseOrdersForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutPurchaseOrdersNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutPurchaseOrdersUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutPurchaseOrdersInternalServerError()
		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())
	}
}

// NewPutPurchaseOrdersOK creates a PutPurchaseOrdersOK with default headers values
func NewPutPurchaseOrdersOK() *PutPurchaseOrdersOK {
	return &PutPurchaseOrdersOK{}
}

/*PutPurchaseOrdersOK handles this case with default header values.

Taxnexus Response with an array of Message objects in response to a PUT
*/
type PutPurchaseOrdersOK struct {
	AccessControlAllowOrigin string

	Payload *ops_models.PutResponse
}

func (o *PutPurchaseOrdersOK) Error() string {
	return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersOK  %+v", 200, o.Payload)
}

func (o *PutPurchaseOrdersOK) GetPayload() *ops_models.PutResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.PutResponse)

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

	return nil
}

// NewPutPurchaseOrdersUnauthorized creates a PutPurchaseOrdersUnauthorized with default headers values
func NewPutPurchaseOrdersUnauthorized() *PutPurchaseOrdersUnauthorized {
	return &PutPurchaseOrdersUnauthorized{}
}

/*PutPurchaseOrdersUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PutPurchaseOrdersUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutPurchaseOrdersUnauthorized) Error() string {
	return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersUnauthorized  %+v", 401, o.Payload)
}

func (o *PutPurchaseOrdersUnauthorized) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutPurchaseOrdersForbidden creates a PutPurchaseOrdersForbidden with default headers values
func NewPutPurchaseOrdersForbidden() *PutPurchaseOrdersForbidden {
	return &PutPurchaseOrdersForbidden{}
}

/*PutPurchaseOrdersForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PutPurchaseOrdersForbidden struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutPurchaseOrdersForbidden) Error() string {
	return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersForbidden  %+v", 403, o.Payload)
}

func (o *PutPurchaseOrdersForbidden) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutPurchaseOrdersNotFound creates a PutPurchaseOrdersNotFound with default headers values
func NewPutPurchaseOrdersNotFound() *PutPurchaseOrdersNotFound {
	return &PutPurchaseOrdersNotFound{}
}

/*PutPurchaseOrdersNotFound handles this case with default header values.

Resource was not found
*/
type PutPurchaseOrdersNotFound struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutPurchaseOrdersNotFound) Error() string {
	return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersNotFound  %+v", 404, o.Payload)
}

func (o *PutPurchaseOrdersNotFound) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutPurchaseOrdersUnprocessableEntity creates a PutPurchaseOrdersUnprocessableEntity with default headers values
func NewPutPurchaseOrdersUnprocessableEntity() *PutPurchaseOrdersUnprocessableEntity {
	return &PutPurchaseOrdersUnprocessableEntity{}
}

/*PutPurchaseOrdersUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PutPurchaseOrdersUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutPurchaseOrdersUnprocessableEntity) Error() string {
	return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PutPurchaseOrdersUnprocessableEntity) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutPurchaseOrdersInternalServerError creates a PutPurchaseOrdersInternalServerError with default headers values
func NewPutPurchaseOrdersInternalServerError() *PutPurchaseOrdersInternalServerError {
	return &PutPurchaseOrdersInternalServerError{}
}

/*PutPurchaseOrdersInternalServerError handles this case with default header values.

Server Internal Error
*/
type PutPurchaseOrdersInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *PutPurchaseOrdersInternalServerError) Error() string {
	return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersInternalServerError  %+v", 500, o.Payload)
}

func (o *PutPurchaseOrdersInternalServerError) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}
