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

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

// PutOrdersReader is a Reader for the PutOrders structure.
type PutOrdersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutOrdersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutOrdersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutOrdersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutOrdersForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutOrdersNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutOrdersUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutOrdersInternalServerError()
		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())
	}
}

// NewPutOrdersOK creates a PutOrdersOK with default headers values
func NewPutOrdersOK() *PutOrdersOK {
	return &PutOrdersOK{}
}

/*PutOrdersOK handles this case with default header values.

Taxnexus Response with an array of Message objects in response to a PUT
*/
type PutOrdersOK struct {
	AccessControlAllowOrigin string

	Payload *ops_models.PutResponse
}

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

func (o *PutOrdersOK) GetPayload() *ops_models.PutResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.PutResponse)

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

	return nil
}

// NewPutOrdersUnauthorized creates a PutOrdersUnauthorized with default headers values
func NewPutOrdersUnauthorized() *PutOrdersUnauthorized {
	return &PutOrdersUnauthorized{}
}

/*PutOrdersUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PutOrdersUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutOrdersUnauthorized) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutOrdersForbidden creates a PutOrdersForbidden with default headers values
func NewPutOrdersForbidden() *PutOrdersForbidden {
	return &PutOrdersForbidden{}
}

/*PutOrdersForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PutOrdersForbidden struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutOrdersForbidden) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutOrdersNotFound creates a PutOrdersNotFound with default headers values
func NewPutOrdersNotFound() *PutOrdersNotFound {
	return &PutOrdersNotFound{}
}

/*PutOrdersNotFound handles this case with default header values.

Resource was not found
*/
type PutOrdersNotFound struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutOrdersNotFound) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutOrdersUnprocessableEntity creates a PutOrdersUnprocessableEntity with default headers values
func NewPutOrdersUnprocessableEntity() *PutOrdersUnprocessableEntity {
	return &PutOrdersUnprocessableEntity{}
}

/*PutOrdersUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PutOrdersUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutOrdersUnprocessableEntity) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutOrdersInternalServerError creates a PutOrdersInternalServerError with default headers values
func NewPutOrdersInternalServerError() *PutOrdersInternalServerError {
	return &PutOrdersInternalServerError{}
}

/*PutOrdersInternalServerError handles this case with default header values.

Server Internal Error
*/
type PutOrdersInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutOrdersInternalServerError) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}
