// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package orders

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// 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) (any, 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("[PUT /orders] putOrders", response, response.Code())
	}
}

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

// PutOrdersOK describes a response with status code 200, with default header values.
//
// Order Response Object
type PutOrdersOK struct {
	Payload *members_models.OrderResponse
}

// IsSuccess returns true when this put orders o k response has a 2xx status code
func (o *PutOrdersOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put orders o k response has a 3xx status code
func (o *PutOrdersOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put orders o k response has a 4xx status code
func (o *PutOrdersOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put orders o k response has a 5xx status code
func (o *PutOrdersOK) IsServerError() bool {
	return false
}

// IsCode returns true when this put orders o k response a status code equal to that given
func (o *PutOrdersOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the put orders o k response
func (o *PutOrdersOK) Code() int {
	return 200
}

func (o *PutOrdersOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersOK %s", 200, payload)
}

func (o *PutOrdersOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersOK %s", 200, payload)
}

func (o *PutOrdersOK) GetPayload() *members_models.OrderResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.OrderResponse)

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

	return nil
}

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

// PutOrdersUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type PutOrdersUnauthorized struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this put orders unauthorized response has a 2xx status code
func (o *PutOrdersUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put orders unauthorized response has a 3xx status code
func (o *PutOrdersUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put orders unauthorized response has a 4xx status code
func (o *PutOrdersUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this put orders unauthorized response has a 5xx status code
func (o *PutOrdersUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this put orders unauthorized response a status code equal to that given
func (o *PutOrdersUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the put orders unauthorized response
func (o *PutOrdersUnauthorized) Code() int {
	return 401
}

func (o *PutOrdersUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersUnauthorized %s", 401, payload)
}

func (o *PutOrdersUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersUnauthorized %s", 401, payload)
}

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

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

	o.Payload = new(members_models.Error)

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

	return nil
}

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

// PutOrdersForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutOrdersForbidden struct {
	AccessControlAllowOrigin string

	Payload *members_models.Error
}

// IsSuccess returns true when this put orders forbidden response has a 2xx status code
func (o *PutOrdersForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put orders forbidden response has a 3xx status code
func (o *PutOrdersForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put orders forbidden response has a 4xx status code
func (o *PutOrdersForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this put orders forbidden response has a 5xx status code
func (o *PutOrdersForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this put orders forbidden response a status code equal to that given
func (o *PutOrdersForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the put orders forbidden response
func (o *PutOrdersForbidden) Code() int {
	return 403
}

func (o *PutOrdersForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersForbidden %s", 403, payload)
}

func (o *PutOrdersForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersForbidden %s", 403, payload)
}

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

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(members_models.Error)

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

	return nil
}

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

// PutOrdersNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PutOrdersNotFound struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this put orders not found response has a 2xx status code
func (o *PutOrdersNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put orders not found response has a 3xx status code
func (o *PutOrdersNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put orders not found response has a 4xx status code
func (o *PutOrdersNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this put orders not found response has a 5xx status code
func (o *PutOrdersNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this put orders not found response a status code equal to that given
func (o *PutOrdersNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the put orders not found response
func (o *PutOrdersNotFound) Code() int {
	return 404
}

func (o *PutOrdersNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersNotFound %s", 404, payload)
}

func (o *PutOrdersNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersNotFound %s", 404, payload)
}

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

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

	o.Payload = new(members_models.Error)

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

	return nil
}

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

// PutOrdersUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PutOrdersUnprocessableEntity struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this put orders unprocessable entity response has a 2xx status code
func (o *PutOrdersUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put orders unprocessable entity response has a 3xx status code
func (o *PutOrdersUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put orders unprocessable entity response has a 4xx status code
func (o *PutOrdersUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this put orders unprocessable entity response has a 5xx status code
func (o *PutOrdersUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this put orders unprocessable entity response a status code equal to that given
func (o *PutOrdersUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the put orders unprocessable entity response
func (o *PutOrdersUnprocessableEntity) Code() int {
	return 422
}

func (o *PutOrdersUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersUnprocessableEntity %s", 422, payload)
}

func (o *PutOrdersUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersUnprocessableEntity %s", 422, payload)
}

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

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

	o.Payload = new(members_models.Error)

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

	return nil
}

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

// PutOrdersInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PutOrdersInternalServerError struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this put orders internal server error response has a 2xx status code
func (o *PutOrdersInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put orders internal server error response has a 3xx status code
func (o *PutOrdersInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put orders internal server error response has a 4xx status code
func (o *PutOrdersInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this put orders internal server error response has a 5xx status code
func (o *PutOrdersInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this put orders internal server error response a status code equal to that given
func (o *PutOrdersInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the put orders internal server error response
func (o *PutOrdersInternalServerError) Code() int {
	return 500
}

func (o *PutOrdersInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersInternalServerError %s", 500, payload)
}

func (o *PutOrdersInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /orders][%d] putOrdersInternalServerError %s", 500, payload)
}

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

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

	o.Payload = new(members_models.Error)

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

	return nil
}
