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

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

// GetCountiesReader is a Reader for the GetCounties structure.
type GetCountiesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCountiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCountiesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCountiesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCountiesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCountiesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCountiesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCountiesInternalServerError()
		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())
	}
}

// NewGetCountiesOK creates a GetCountiesOK with default headers values
func NewGetCountiesOK() *GetCountiesOK {
	return &GetCountiesOK{}
}

/*GetCountiesOK handles this case with default header values.

Taxnexus Response with an array of County objects
*/
type GetCountiesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.CountyResponse
}

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

func (o *GetCountiesOK) GetPayload() *geo_models.CountyResponse {
	return o.Payload
}

func (o *GetCountiesOK) 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.CountyResponse)

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

	return nil
}

// NewGetCountiesUnauthorized creates a GetCountiesUnauthorized with default headers values
func NewGetCountiesUnauthorized() *GetCountiesUnauthorized {
	return &GetCountiesUnauthorized{}
}

/*GetCountiesUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountiesForbidden creates a GetCountiesForbidden with default headers values
func NewGetCountiesForbidden() *GetCountiesForbidden {
	return &GetCountiesForbidden{}
}

/*GetCountiesForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountiesNotFound creates a GetCountiesNotFound with default headers values
func NewGetCountiesNotFound() *GetCountiesNotFound {
	return &GetCountiesNotFound{}
}

/*GetCountiesNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountiesUnprocessableEntity creates a GetCountiesUnprocessableEntity with default headers values
func NewGetCountiesUnprocessableEntity() *GetCountiesUnprocessableEntity {
	return &GetCountiesUnprocessableEntity{}
}

/*GetCountiesUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewGetCountiesInternalServerError creates a GetCountiesInternalServerError with default headers values
func NewGetCountiesInternalServerError() *GetCountiesInternalServerError {
	return &GetCountiesInternalServerError{}
}

/*GetCountiesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetCountiesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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