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

// PostPosReader is a Reader for the PostPos structure.
type PostPosReader struct {
	formats strfmt.Registry
}

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

// NewPostPosOK creates a PostPosOK with default headers values
func NewPostPosOK() *PostPosOK {
	return &PostPosOK{}
}

/*PostPosOK handles this case with default header values.

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

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

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

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

// NewPostPosUnauthorized creates a PostPosUnauthorized with default headers values
func NewPostPosUnauthorized() *PostPosUnauthorized {
	return &PostPosUnauthorized{}
}

/*PostPosUnauthorized handles this case with default header values.

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

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

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

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

// NewPostPosForbidden creates a PostPosForbidden with default headers values
func NewPostPosForbidden() *PostPosForbidden {
	return &PostPosForbidden{}
}

/*PostPosForbidden handles this case with default header values.

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

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

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

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

// NewPostPosNotFound creates a PostPosNotFound with default headers values
func NewPostPosNotFound() *PostPosNotFound {
	return &PostPosNotFound{}
}

/*PostPosNotFound handles this case with default header values.

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

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

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

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

// NewPostPosInternalServerError creates a PostPosInternalServerError with default headers values
func NewPostPosInternalServerError() *PostPosInternalServerError {
	return &PostPosInternalServerError{}
}

/*PostPosInternalServerError handles this case with default header values.

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

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

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

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