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

// (c) 2012-2023 by Vernon Keenan
// 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"

	"code.tnxs.net/work/lib/api/members/members_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 422:
		result := NewPostOrdersUnprocessableEntity()
		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("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

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

/*
PostOrdersOK describes a response with status code 200, with default header values.

Order Response Object
*/
type PostOrdersOK struct {
	Payload *members_models.OrderResponse
}

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

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

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

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

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

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

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

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

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

func (o *PostOrdersOK) 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 && err != io.EOF {
		return err
	}

	return nil
}

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

/*
PostOrdersUnauthorized describes a response with status code 401, with default header values.

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

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

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

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

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

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

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

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

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

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

func (o *PostOrdersUnauthorized) 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 && err != io.EOF {
		return err
	}

	return nil
}

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

/*
PostOrdersForbidden describes a response with status code 403, with default header values.

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

func (o *PostOrdersForbidden) 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 && err != io.EOF {
		return err
	}

	return nil
}

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

/*
PostOrdersNotFound describes a response with status code 404, with default header values.

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

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

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

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

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

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

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

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

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

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

func (o *PostOrdersNotFound) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostOrdersUnprocessableEntity creates a PostOrdersUnprocessableEntity with default headers values
func NewPostOrdersUnprocessableEntity() *PostOrdersUnprocessableEntity {
	return &PostOrdersUnprocessableEntity{}
}

/*
PostOrdersUnprocessableEntity describes a response with status code 422, with default header values.

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

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

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

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

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

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

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

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

func (o *PostOrdersUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /orders][%d] postOrdersUnprocessableEntity  %+v", 422, o.Payload)
}

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

func (o *PostOrdersUnprocessableEntity) 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 && err != io.EOF {
		return err
	}

	return nil
}

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

/*
PostOrdersInternalServerError describes a response with status code 500, with default header values.

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

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

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

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

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

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

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

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

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

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

func (o *PostOrdersInternalServerError) 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 && err != io.EOF {
		return err
	}

	return nil
}
