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

// GetOrdersReader is a Reader for the GetOrders structure.
type GetOrdersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetOrdersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetOrdersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetOrdersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetOrdersForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetOrdersNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetOrdersUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetOrdersInternalServerError()
		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())
	}
}

// NewGetOrdersOK creates a GetOrdersOK with default headers values
func NewGetOrdersOK() *GetOrdersOK {
	return &GetOrdersOK{}
}

/*GetOrdersOK handles this case with default header values.

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

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

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

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

// NewGetOrdersUnauthorized creates a GetOrdersUnauthorized with default headers values
func NewGetOrdersUnauthorized() *GetOrdersUnauthorized {
	return &GetOrdersUnauthorized{}
}

/*GetOrdersUnauthorized handles this case with default header values.

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

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

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

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

// NewGetOrdersForbidden creates a GetOrdersForbidden with default headers values
func NewGetOrdersForbidden() *GetOrdersForbidden {
	return &GetOrdersForbidden{}
}

/*GetOrdersForbidden handles this case with default header values.

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

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

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

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

// NewGetOrdersNotFound creates a GetOrdersNotFound with default headers values
func NewGetOrdersNotFound() *GetOrdersNotFound {
	return &GetOrdersNotFound{}
}

/*GetOrdersNotFound handles this case with default header values.

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

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

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

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

// NewGetOrdersUnprocessableEntity creates a GetOrdersUnprocessableEntity with default headers values
func NewGetOrdersUnprocessableEntity() *GetOrdersUnprocessableEntity {
	return &GetOrdersUnprocessableEntity{}
}

/*GetOrdersUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewGetOrdersInternalServerError creates a GetOrdersInternalServerError with default headers values
func NewGetOrdersInternalServerError() *GetOrdersInternalServerError {
	return &GetOrdersInternalServerError{}
}

/*GetOrdersInternalServerError handles this case with default header values.

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

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

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

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