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

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

// GetPlacesReader is a Reader for the GetPlaces structure.
type GetPlacesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetPlacesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetPlacesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetPlacesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetPlacesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetPlacesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetPlacesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetPlacesInternalServerError()
		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())
	}
}

// NewGetPlacesOK creates a GetPlacesOK with default headers values
func NewGetPlacesOK() *GetPlacesOK {
	return &GetPlacesOK{}
}

/*GetPlacesOK handles this case with default header values.

Taxnexus Response with an array of Place objects
*/
type GetPlacesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.PlaceResponse
}

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

func (o *GetPlacesOK) GetPayload() *geo_models.PlaceResponse {
	return o.Payload
}

func (o *GetPlacesOK) 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.PlaceResponse)

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

	return nil
}

// NewGetPlacesUnauthorized creates a GetPlacesUnauthorized with default headers values
func NewGetPlacesUnauthorized() *GetPlacesUnauthorized {
	return &GetPlacesUnauthorized{}
}

/*GetPlacesUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetPlacesForbidden creates a GetPlacesForbidden with default headers values
func NewGetPlacesForbidden() *GetPlacesForbidden {
	return &GetPlacesForbidden{}
}

/*GetPlacesForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetPlacesNotFound creates a GetPlacesNotFound with default headers values
func NewGetPlacesNotFound() *GetPlacesNotFound {
	return &GetPlacesNotFound{}
}

/*GetPlacesNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetPlacesUnprocessableEntity creates a GetPlacesUnprocessableEntity with default headers values
func NewGetPlacesUnprocessableEntity() *GetPlacesUnprocessableEntity {
	return &GetPlacesUnprocessableEntity{}
}

/*GetPlacesUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetPlacesInternalServerError creates a GetPlacesInternalServerError with default headers values
func NewGetPlacesInternalServerError() *GetPlacesInternalServerError {
	return &GetPlacesInternalServerError{}
}

/*GetPlacesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetPlacesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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