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

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

	"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
)

// GetCountriesObservableReader is a Reader for the GetCountriesObservable structure.
type GetCountriesObservableReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCountriesObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCountriesObservableOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCountriesObservableUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCountriesObservableForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCountriesObservableNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCountriesObservableUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCountriesObservableInternalServerError()
		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())
	}
}

// NewGetCountriesObservableOK creates a GetCountriesObservableOK with default headers values
func NewGetCountriesObservableOK() *GetCountriesObservableOK {
	return &GetCountriesObservableOK{}
}

/*GetCountriesObservableOK handles this case with default header values.

Observable array response to a country retrieval
*/
type GetCountriesObservableOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload []*geo_models.Country
}

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

func (o *GetCountriesObservableOK) GetPayload() []*geo_models.Country {
	return o.Payload
}

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

// NewGetCountriesObservableUnauthorized creates a GetCountriesObservableUnauthorized with default headers values
func NewGetCountriesObservableUnauthorized() *GetCountriesObservableUnauthorized {
	return &GetCountriesObservableUnauthorized{}
}

/*GetCountriesObservableUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountriesObservableForbidden creates a GetCountriesObservableForbidden with default headers values
func NewGetCountriesObservableForbidden() *GetCountriesObservableForbidden {
	return &GetCountriesObservableForbidden{}
}

/*GetCountriesObservableForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountriesObservableNotFound creates a GetCountriesObservableNotFound with default headers values
func NewGetCountriesObservableNotFound() *GetCountriesObservableNotFound {
	return &GetCountriesObservableNotFound{}
}

/*GetCountriesObservableNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountriesObservableUnprocessableEntity creates a GetCountriesObservableUnprocessableEntity with default headers values
func NewGetCountriesObservableUnprocessableEntity() *GetCountriesObservableUnprocessableEntity {
	return &GetCountriesObservableUnprocessableEntity{}
}

/*GetCountriesObservableUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountriesObservableInternalServerError creates a GetCountriesObservableInternalServerError with default headers values
func NewGetCountriesObservableInternalServerError() *GetCountriesObservableInternalServerError {
	return &GetCountriesObservableInternalServerError{}
}

/*GetCountriesObservableInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetCountriesObservableInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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