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

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

// GetAuthoritiesReader is a Reader for the GetAuthorities structure.
type GetAuthoritiesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetAuthoritiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetAuthoritiesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetAuthoritiesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetAuthoritiesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetAuthoritiesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetAuthoritiesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetAuthoritiesInternalServerError()
		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())
	}
}

// NewGetAuthoritiesOK creates a GetAuthoritiesOK with default headers values
func NewGetAuthoritiesOK() *GetAuthoritiesOK {
	return &GetAuthoritiesOK{}
}

/*GetAuthoritiesOK handles this case with default header values.

Taxnexus Response with an array of Authority objects
*/
type GetAuthoritiesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *regs_models.AuthorityResponse
}

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

func (o *GetAuthoritiesOK) GetPayload() *regs_models.AuthorityResponse {
	return o.Payload
}

func (o *GetAuthoritiesOK) 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(regs_models.AuthorityResponse)

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

	return nil
}

// NewGetAuthoritiesUnauthorized creates a GetAuthoritiesUnauthorized with default headers values
func NewGetAuthoritiesUnauthorized() *GetAuthoritiesUnauthorized {
	return &GetAuthoritiesUnauthorized{}
}

/*GetAuthoritiesUnauthorized handles this case with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type GetAuthoritiesUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

func (o *GetAuthoritiesUnauthorized) GetPayload() *regs_models.Error {
	return o.Payload
}

func (o *GetAuthoritiesUnauthorized) 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(regs_models.Error)

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

	return nil
}

// NewGetAuthoritiesForbidden creates a GetAuthoritiesForbidden with default headers values
func NewGetAuthoritiesForbidden() *GetAuthoritiesForbidden {
	return &GetAuthoritiesForbidden{}
}

/*GetAuthoritiesForbidden handles this case with default header values.

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

	Payload *regs_models.Error
}

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

func (o *GetAuthoritiesForbidden) GetPayload() *regs_models.Error {
	return o.Payload
}

func (o *GetAuthoritiesForbidden) 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(regs_models.Error)

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

	return nil
}

// NewGetAuthoritiesNotFound creates a GetAuthoritiesNotFound with default headers values
func NewGetAuthoritiesNotFound() *GetAuthoritiesNotFound {
	return &GetAuthoritiesNotFound{}
}

/*GetAuthoritiesNotFound handles this case with default header values.

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

	Payload *regs_models.Error
}

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

func (o *GetAuthoritiesNotFound) GetPayload() *regs_models.Error {
	return o.Payload
}

func (o *GetAuthoritiesNotFound) 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(regs_models.Error)

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

	return nil
}

// NewGetAuthoritiesUnprocessableEntity creates a GetAuthoritiesUnprocessableEntity with default headers values
func NewGetAuthoritiesUnprocessableEntity() *GetAuthoritiesUnprocessableEntity {
	return &GetAuthoritiesUnprocessableEntity{}
}

/*GetAuthoritiesUnprocessableEntity handles this case with default header values.

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

	Payload *regs_models.Error
}

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

func (o *GetAuthoritiesUnprocessableEntity) GetPayload() *regs_models.Error {
	return o.Payload
}

func (o *GetAuthoritiesUnprocessableEntity) 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(regs_models.Error)

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

	return nil
}

// NewGetAuthoritiesInternalServerError creates a GetAuthoritiesInternalServerError with default headers values
func NewGetAuthoritiesInternalServerError() *GetAuthoritiesInternalServerError {
	return &GetAuthoritiesInternalServerError{}
}

/*GetAuthoritiesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetAuthoritiesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

func (o *GetAuthoritiesInternalServerError) GetPayload() *regs_models.Error {
	return o.Payload
}

func (o *GetAuthoritiesInternalServerError) 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(regs_models.Error)

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

	return nil
}
