// 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/vendor-gw/vendor_gw_models"
)

// GetPosReader is a Reader for the GetPos structure.
type GetPosReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetPosReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetPosOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetPosUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetPosForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetPosNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetPosUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetPosInternalServerError()
		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())
	}
}

// NewGetPosOK creates a GetPosOK with default headers values
func NewGetPosOK() *GetPosOK {
	return &GetPosOK{}
}

/*GetPosOK handles this case with default header values.

An array of Purchase Order objects
*/
type GetPosOK struct {
	Payload *vendor_gw_models.PurchaseOrderResponse
}

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

func (o *GetPosOK) GetPayload() *vendor_gw_models.PurchaseOrderResponse {
	return o.Payload
}

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

	o.Payload = new(vendor_gw_models.PurchaseOrderResponse)

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

	return nil
}

// NewGetPosUnauthorized creates a GetPosUnauthorized with default headers values
func NewGetPosUnauthorized() *GetPosUnauthorized {
	return &GetPosUnauthorized{}
}

/*GetPosUnauthorized handles this case with default header values.

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

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

func (o *GetPosUnauthorized) GetPayload() *vendor_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(vendor_gw_models.Error)

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

	return nil
}

// NewGetPosForbidden creates a GetPosForbidden with default headers values
func NewGetPosForbidden() *GetPosForbidden {
	return &GetPosForbidden{}
}

/*GetPosForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetPosForbidden struct {
	Payload *vendor_gw_models.Error
}

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

func (o *GetPosForbidden) GetPayload() *vendor_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(vendor_gw_models.Error)

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

	return nil
}

// NewGetPosNotFound creates a GetPosNotFound with default headers values
func NewGetPosNotFound() *GetPosNotFound {
	return &GetPosNotFound{}
}

/*GetPosNotFound handles this case with default header values.

Resource was not found
*/
type GetPosNotFound struct {
	Payload *vendor_gw_models.Error
}

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

func (o *GetPosNotFound) GetPayload() *vendor_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(vendor_gw_models.Error)

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

	return nil
}

// NewGetPosUnprocessableEntity creates a GetPosUnprocessableEntity with default headers values
func NewGetPosUnprocessableEntity() *GetPosUnprocessableEntity {
	return &GetPosUnprocessableEntity{}
}

/*GetPosUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type GetPosUnprocessableEntity struct {
	Payload *vendor_gw_models.Error
}

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

func (o *GetPosUnprocessableEntity) GetPayload() *vendor_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(vendor_gw_models.Error)

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

	return nil
}

// NewGetPosInternalServerError creates a GetPosInternalServerError with default headers values
func NewGetPosInternalServerError() *GetPosInternalServerError {
	return &GetPosInternalServerError{}
}

/*GetPosInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetPosInternalServerError struct {
	Payload *vendor_gw_models.Error
}

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

func (o *GetPosInternalServerError) GetPayload() *vendor_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(vendor_gw_models.Error)

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

	return nil
}
