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

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

// PostTaxesOrdersReader is a Reader for the PostTaxesOrders structure.
type PostTaxesOrdersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTaxesOrdersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostTaxesOrdersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostTaxesOrdersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostTaxesOrdersForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostTaxesOrdersNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostTaxesOrdersUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostTaxesOrdersInternalServerError()
		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())
	}
}

// NewPostTaxesOrdersOK creates a PostTaxesOrdersOK with default headers values
func NewPostTaxesOrdersOK() *PostTaxesOrdersOK {
	return &PostTaxesOrdersOK{}
}

/*PostTaxesOrdersOK handles this case with default header values.

Taxnexus Response with Tax Transaction Objects
*/
type PostTaxesOrdersOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *ops_models.TaxTransactionResponse
}

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

func (o *PostTaxesOrdersOK) GetPayload() *ops_models.TaxTransactionResponse {
	return o.Payload
}

func (o *PostTaxesOrdersOK) 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")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(ops_models.TaxTransactionResponse)

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

	return nil
}

// NewPostTaxesOrdersUnauthorized creates a PostTaxesOrdersUnauthorized with default headers values
func NewPostTaxesOrdersUnauthorized() *PostTaxesOrdersUnauthorized {
	return &PostTaxesOrdersUnauthorized{}
}

/*PostTaxesOrdersUnauthorized handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

// NewPostTaxesOrdersForbidden creates a PostTaxesOrdersForbidden with default headers values
func NewPostTaxesOrdersForbidden() *PostTaxesOrdersForbidden {
	return &PostTaxesOrdersForbidden{}
}

/*PostTaxesOrdersForbidden handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

// NewPostTaxesOrdersNotFound creates a PostTaxesOrdersNotFound with default headers values
func NewPostTaxesOrdersNotFound() *PostTaxesOrdersNotFound {
	return &PostTaxesOrdersNotFound{}
}

/*PostTaxesOrdersNotFound handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

// NewPostTaxesOrdersUnprocessableEntity creates a PostTaxesOrdersUnprocessableEntity with default headers values
func NewPostTaxesOrdersUnprocessableEntity() *PostTaxesOrdersUnprocessableEntity {
	return &PostTaxesOrdersUnprocessableEntity{}
}

/*PostTaxesOrdersUnprocessableEntity handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

// NewPostTaxesOrdersInternalServerError creates a PostTaxesOrdersInternalServerError with default headers values
func NewPostTaxesOrdersInternalServerError() *PostTaxesOrdersInternalServerError {
	return &PostTaxesOrdersInternalServerError{}
}

/*PostTaxesOrdersInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostTaxesOrdersInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

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

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