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

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

// GetStateObservableReader is a Reader for the GetStateObservable structure.
type GetStateObservableReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetStateObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetStateObservableOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetStateObservableUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetStateObservableForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetStateObservableNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetStateObservableUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetStateObservableInternalServerError()
		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())
	}
}

// NewGetStateObservableOK creates a GetStateObservableOK with default headers values
func NewGetStateObservableOK() *GetStateObservableOK {
	return &GetStateObservableOK{}
}

/*GetStateObservableOK handles this case with default header values.

Observable array response to a state retrieval
*/
type GetStateObservableOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload []*geo_models.State
}

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

func (o *GetStateObservableOK) GetPayload() []*geo_models.State {
	return o.Payload
}

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

// NewGetStateObservableUnauthorized creates a GetStateObservableUnauthorized with default headers values
func NewGetStateObservableUnauthorized() *GetStateObservableUnauthorized {
	return &GetStateObservableUnauthorized{}
}

/*GetStateObservableUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetStateObservableForbidden creates a GetStateObservableForbidden with default headers values
func NewGetStateObservableForbidden() *GetStateObservableForbidden {
	return &GetStateObservableForbidden{}
}

/*GetStateObservableForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetStateObservableNotFound creates a GetStateObservableNotFound with default headers values
func NewGetStateObservableNotFound() *GetStateObservableNotFound {
	return &GetStateObservableNotFound{}
}

/*GetStateObservableNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetStateObservableUnprocessableEntity creates a GetStateObservableUnprocessableEntity with default headers values
func NewGetStateObservableUnprocessableEntity() *GetStateObservableUnprocessableEntity {
	return &GetStateObservableUnprocessableEntity{}
}

/*GetStateObservableUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetStateObservableInternalServerError creates a GetStateObservableInternalServerError with default headers values
func NewGetStateObservableInternalServerError() *GetStateObservableInternalServerError {
	return &GetStateObservableInternalServerError{}
}

/*GetStateObservableInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetStateObservableInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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