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

// 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/sf-gate/sf_gate_models"
)

// PutPosReader is a Reader for the PutPos structure.
type PutPosReader struct {
	formats strfmt.Registry
}

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

// NewPutPosOK creates a PutPosOK with default headers values
func NewPutPosOK() *PutPosOK {
	return &PutPosOK{}
}

/*PutPosOK handles this case with default header values.

An array of Purchase Order objects
*/
type PutPosOK struct {
	Payload *sf_gate_models.PurchaseOrderResponse
}

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

func (o *PutPosOK) GetPayload() *sf_gate_models.PurchaseOrderResponse {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.PurchaseOrderResponse)

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

	return nil
}

// NewPutPosUnauthorized creates a PutPosUnauthorized with default headers values
func NewPutPosUnauthorized() *PutPosUnauthorized {
	return &PutPosUnauthorized{}
}

/*PutPosUnauthorized handles this case with default header values.

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

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

func (o *PutPosUnauthorized) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewPutPosForbidden creates a PutPosForbidden with default headers values
func NewPutPosForbidden() *PutPosForbidden {
	return &PutPosForbidden{}
}

/*PutPosForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PutPosForbidden struct {
	Payload *sf_gate_models.Error
}

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

func (o *PutPosForbidden) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewPutPosNotFound creates a PutPosNotFound with default headers values
func NewPutPosNotFound() *PutPosNotFound {
	return &PutPosNotFound{}
}

/*PutPosNotFound handles this case with default header values.

Resource was not found
*/
type PutPosNotFound struct {
	Payload *sf_gate_models.Error
}

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

func (o *PutPosNotFound) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewPutPosInternalServerError creates a PutPosInternalServerError with default headers values
func NewPutPosInternalServerError() *PutPosInternalServerError {
	return &PutPosInternalServerError{}
}

/*PutPosInternalServerError handles this case with default header values.

Server Internal Error
*/
type PutPosInternalServerError struct {
	Payload *sf_gate_models.Error
}

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

func (o *PutPosInternalServerError) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}
