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

// PostOrdersReader is a Reader for the PostOrders structure.
type PostOrdersReader struct {
	formats strfmt.Registry
}

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

// NewPostOrdersOK creates a PostOrdersOK with default headers values
func NewPostOrdersOK() *PostOrdersOK {
	return &PostOrdersOK{}
}

/*PostOrdersOK handles this case with default header values.

An array of Order objects
*/
type PostOrdersOK struct {
	Payload *sf_gate_models.OrderResponse
}

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

func (o *PostOrdersOK) GetPayload() *sf_gate_models.OrderResponse {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.OrderResponse)

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

	return nil
}

// NewPostOrdersUnauthorized creates a PostOrdersUnauthorized with default headers values
func NewPostOrdersUnauthorized() *PostOrdersUnauthorized {
	return &PostOrdersUnauthorized{}
}

/*PostOrdersUnauthorized handles this case with default header values.

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

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

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

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

// NewPostOrdersForbidden creates a PostOrdersForbidden with default headers values
func NewPostOrdersForbidden() *PostOrdersForbidden {
	return &PostOrdersForbidden{}
}

/*PostOrdersForbidden handles this case with default header values.

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

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

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

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

// NewPostOrdersNotFound creates a PostOrdersNotFound with default headers values
func NewPostOrdersNotFound() *PostOrdersNotFound {
	return &PostOrdersNotFound{}
}

/*PostOrdersNotFound handles this case with default header values.

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

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

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

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

// NewPostOrdersInternalServerError creates a PostOrdersInternalServerError with default headers values
func NewPostOrdersInternalServerError() *PostOrdersInternalServerError {
	return &PostOrdersInternalServerError{}
}

/*PostOrdersInternalServerError handles this case with default header values.

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

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

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

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