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

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

// GetTaxnexusCodeObservableReader is a Reader for the GetTaxnexusCodeObservable structure.
type GetTaxnexusCodeObservableReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetTaxnexusCodeObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetTaxnexusCodeObservableOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetTaxnexusCodeObservableUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetTaxnexusCodeObservableForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetTaxnexusCodeObservableNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetTaxnexusCodeObservableUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetTaxnexusCodeObservableInternalServerError()
		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())
	}
}

// NewGetTaxnexusCodeObservableOK creates a GetTaxnexusCodeObservableOK with default headers values
func NewGetTaxnexusCodeObservableOK() *GetTaxnexusCodeObservableOK {
	return &GetTaxnexusCodeObservableOK{}
}

/*GetTaxnexusCodeObservableOK handles this case with default header values.

Observable array response to a Taxnexus Code retrieval
*/
type GetTaxnexusCodeObservableOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload []*geo_models.TaxnexusCode
}

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

func (o *GetTaxnexusCodeObservableOK) GetPayload() []*geo_models.TaxnexusCode {
	return o.Payload
}

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

// NewGetTaxnexusCodeObservableUnauthorized creates a GetTaxnexusCodeObservableUnauthorized with default headers values
func NewGetTaxnexusCodeObservableUnauthorized() *GetTaxnexusCodeObservableUnauthorized {
	return &GetTaxnexusCodeObservableUnauthorized{}
}

/*GetTaxnexusCodeObservableUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxnexusCodeObservableForbidden creates a GetTaxnexusCodeObservableForbidden with default headers values
func NewGetTaxnexusCodeObservableForbidden() *GetTaxnexusCodeObservableForbidden {
	return &GetTaxnexusCodeObservableForbidden{}
}

/*GetTaxnexusCodeObservableForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxnexusCodeObservableNotFound creates a GetTaxnexusCodeObservableNotFound with default headers values
func NewGetTaxnexusCodeObservableNotFound() *GetTaxnexusCodeObservableNotFound {
	return &GetTaxnexusCodeObservableNotFound{}
}

/*GetTaxnexusCodeObservableNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxnexusCodeObservableUnprocessableEntity creates a GetTaxnexusCodeObservableUnprocessableEntity with default headers values
func NewGetTaxnexusCodeObservableUnprocessableEntity() *GetTaxnexusCodeObservableUnprocessableEntity {
	return &GetTaxnexusCodeObservableUnprocessableEntity{}
}

/*GetTaxnexusCodeObservableUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetTaxnexusCodeObservableInternalServerError creates a GetTaxnexusCodeObservableInternalServerError with default headers values
func NewGetTaxnexusCodeObservableInternalServerError() *GetTaxnexusCodeObservableInternalServerError {
	return &GetTaxnexusCodeObservableInternalServerError{}
}

/*GetTaxnexusCodeObservableInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetTaxnexusCodeObservableInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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