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

// PutAuthoritiesReader is a Reader for the PutAuthorities structure.
type PutAuthoritiesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutAuthoritiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutAuthoritiesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutAuthoritiesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutAuthoritiesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutAuthoritiesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutAuthoritiesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutAuthoritiesInternalServerError()
		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())
	}
}

// NewPutAuthoritiesOK creates a PutAuthoritiesOK with default headers values
func NewPutAuthoritiesOK() *PutAuthoritiesOK {
	return &PutAuthoritiesOK{}
}

/*PutAuthoritiesOK handles this case with default header values.

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

	CacheControl string

	Payload *regs_models.AuthorityResponse
}

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

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

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

// NewPutAuthoritiesUnauthorized creates a PutAuthoritiesUnauthorized with default headers values
func NewPutAuthoritiesUnauthorized() *PutAuthoritiesUnauthorized {
	return &PutAuthoritiesUnauthorized{}
}

/*PutAuthoritiesUnauthorized handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPutAuthoritiesForbidden creates a PutAuthoritiesForbidden with default headers values
func NewPutAuthoritiesForbidden() *PutAuthoritiesForbidden {
	return &PutAuthoritiesForbidden{}
}

/*PutAuthoritiesForbidden handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPutAuthoritiesNotFound creates a PutAuthoritiesNotFound with default headers values
func NewPutAuthoritiesNotFound() *PutAuthoritiesNotFound {
	return &PutAuthoritiesNotFound{}
}

/*PutAuthoritiesNotFound handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPutAuthoritiesUnprocessableEntity creates a PutAuthoritiesUnprocessableEntity with default headers values
func NewPutAuthoritiesUnprocessableEntity() *PutAuthoritiesUnprocessableEntity {
	return &PutAuthoritiesUnprocessableEntity{}
}

/*PutAuthoritiesUnprocessableEntity handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPutAuthoritiesInternalServerError creates a PutAuthoritiesInternalServerError with default headers values
func NewPutAuthoritiesInternalServerError() *PutAuthoritiesInternalServerError {
	return &PutAuthoritiesInternalServerError{}
}

/*PutAuthoritiesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PutAuthoritiesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

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

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