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

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

// GetTaxRateObservableReader is a Reader for the GetTaxRateObservable structure.
type GetTaxRateObservableReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetTaxRateObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetTaxRateObservableOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetTaxRateObservableUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetTaxRateObservableForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetTaxRateObservableNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetTaxRateObservableUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetTaxRateObservableInternalServerError()
		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())
	}
}

// NewGetTaxRateObservableOK creates a GetTaxRateObservableOK with default headers values
func NewGetTaxRateObservableOK() *GetTaxRateObservableOK {
	return &GetTaxRateObservableOK{}
}

/*GetTaxRateObservableOK handles this case with default header values.

Observable array response to a tax rate retrieval
*/
type GetTaxRateObservableOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload []*geo_models.TaxRate
}

func (o *GetTaxRateObservableOK) Error() string {
	return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableOK  %+v", 200, o.Payload)
}

func (o *GetTaxRateObservableOK) GetPayload() []*geo_models.TaxRate {
	return o.Payload
}

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

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

	return nil
}

// NewGetTaxRateObservableUnauthorized creates a GetTaxRateObservableUnauthorized with default headers values
func NewGetTaxRateObservableUnauthorized() *GetTaxRateObservableUnauthorized {
	return &GetTaxRateObservableUnauthorized{}
}

/*GetTaxRateObservableUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

func (o *GetTaxRateObservableUnauthorized) Error() string {
	return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableUnauthorized  %+v", 401, o.Payload)
}

func (o *GetTaxRateObservableUnauthorized) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *GetTaxRateObservableUnauthorized) 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(geo_models.Error)

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

	return nil
}

// NewGetTaxRateObservableForbidden creates a GetTaxRateObservableForbidden with default headers values
func NewGetTaxRateObservableForbidden() *GetTaxRateObservableForbidden {
	return &GetTaxRateObservableForbidden{}
}

/*GetTaxRateObservableForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

func (o *GetTaxRateObservableForbidden) Error() string {
	return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableForbidden  %+v", 403, o.Payload)
}

func (o *GetTaxRateObservableForbidden) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *GetTaxRateObservableForbidden) 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(geo_models.Error)

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

	return nil
}

// NewGetTaxRateObservableNotFound creates a GetTaxRateObservableNotFound with default headers values
func NewGetTaxRateObservableNotFound() *GetTaxRateObservableNotFound {
	return &GetTaxRateObservableNotFound{}
}

/*GetTaxRateObservableNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

func (o *GetTaxRateObservableNotFound) Error() string {
	return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableNotFound  %+v", 404, o.Payload)
}

func (o *GetTaxRateObservableNotFound) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *GetTaxRateObservableNotFound) 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(geo_models.Error)

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

	return nil
}

// NewGetTaxRateObservableUnprocessableEntity creates a GetTaxRateObservableUnprocessableEntity with default headers values
func NewGetTaxRateObservableUnprocessableEntity() *GetTaxRateObservableUnprocessableEntity {
	return &GetTaxRateObservableUnprocessableEntity{}
}

/*GetTaxRateObservableUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

func (o *GetTaxRateObservableUnprocessableEntity) Error() string {
	return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *GetTaxRateObservableUnprocessableEntity) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *GetTaxRateObservableUnprocessableEntity) 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(geo_models.Error)

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

	return nil
}

// NewGetTaxRateObservableInternalServerError creates a GetTaxRateObservableInternalServerError with default headers values
func NewGetTaxRateObservableInternalServerError() *GetTaxRateObservableInternalServerError {
	return &GetTaxRateObservableInternalServerError{}
}

/*GetTaxRateObservableInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetTaxRateObservableInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

func (o *GetTaxRateObservableInternalServerError) Error() string {
	return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableInternalServerError  %+v", 500, o.Payload)
}

func (o *GetTaxRateObservableInternalServerError) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *GetTaxRateObservableInternalServerError) 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(geo_models.Error)

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

	return nil
}
