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

// GetTaxRatesReader is a Reader for the GetTaxRates structure.
type GetTaxRatesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetTaxRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetTaxRatesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetTaxRatesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetTaxRatesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetTaxRatesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetTaxRatesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetTaxRatesInternalServerError()
		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())
	}
}

// NewGetTaxRatesOK creates a GetTaxRatesOK with default headers values
func NewGetTaxRatesOK() *GetTaxRatesOK {
	return &GetTaxRatesOK{}
}

/*GetTaxRatesOK handles this case with default header values.

Taxnexus Response with an array of Tax Rate records
*/
type GetTaxRatesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.TaxRateResponse
}

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

func (o *GetTaxRatesOK) GetPayload() *geo_models.TaxRateResponse {
	return o.Payload
}

func (o *GetTaxRatesOK) 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(geo_models.TaxRateResponse)

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

	return nil
}

// NewGetTaxRatesUnauthorized creates a GetTaxRatesUnauthorized with default headers values
func NewGetTaxRatesUnauthorized() *GetTaxRatesUnauthorized {
	return &GetTaxRatesUnauthorized{}
}

/*GetTaxRatesUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxRatesForbidden creates a GetTaxRatesForbidden with default headers values
func NewGetTaxRatesForbidden() *GetTaxRatesForbidden {
	return &GetTaxRatesForbidden{}
}

/*GetTaxRatesForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxRatesNotFound creates a GetTaxRatesNotFound with default headers values
func NewGetTaxRatesNotFound() *GetTaxRatesNotFound {
	return &GetTaxRatesNotFound{}
}

/*GetTaxRatesNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxRatesUnprocessableEntity creates a GetTaxRatesUnprocessableEntity with default headers values
func NewGetTaxRatesUnprocessableEntity() *GetTaxRatesUnprocessableEntity {
	return &GetTaxRatesUnprocessableEntity{}
}

/*GetTaxRatesUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxRatesInternalServerError creates a GetTaxRatesInternalServerError with default headers values
func NewGetTaxRatesInternalServerError() *GetTaxRatesInternalServerError {
	return &GetTaxRatesInternalServerError{}
}

/*GetTaxRatesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetTaxRatesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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