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

// 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/sf-gate/sf_gate_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 {
	Payload *sf_gate_models.PlaceResponse
}

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

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

func (o *GetPlacesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sf_gate_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 {
	Payload *sf_gate_models.Error
}

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

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

func (o *GetPlacesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sf_gate_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 {
	Payload *sf_gate_models.Error
}

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

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

func (o *GetPlacesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sf_gate_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 {
	Payload *sf_gate_models.Error
}

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

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

func (o *GetPlacesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sf_gate_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 {
	Payload *sf_gate_models.Error
}

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

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

func (o *GetPlacesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sf_gate_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 {
	Payload *sf_gate_models.Error
}

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

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

func (o *GetPlacesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}
