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

// PostAuthoritiesReader is a Reader for the PostAuthorities structure.
type PostAuthoritiesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostAuthoritiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostAuthoritiesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostAuthoritiesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostAuthoritiesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostAuthoritiesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostAuthoritiesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostAuthoritiesInternalServerError()
		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())
	}
}

// NewPostAuthoritiesOK creates a PostAuthoritiesOK with default headers values
func NewPostAuthoritiesOK() *PostAuthoritiesOK {
	return &PostAuthoritiesOK{}
}

/*PostAuthoritiesOK handles this case with default header values.

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

	CacheControl string

	Payload *regs_models.AuthorityResponse
}

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

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

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

// NewPostAuthoritiesUnauthorized creates a PostAuthoritiesUnauthorized with default headers values
func NewPostAuthoritiesUnauthorized() *PostAuthoritiesUnauthorized {
	return &PostAuthoritiesUnauthorized{}
}

/*PostAuthoritiesUnauthorized handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostAuthoritiesForbidden creates a PostAuthoritiesForbidden with default headers values
func NewPostAuthoritiesForbidden() *PostAuthoritiesForbidden {
	return &PostAuthoritiesForbidden{}
}

/*PostAuthoritiesForbidden handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostAuthoritiesNotFound creates a PostAuthoritiesNotFound with default headers values
func NewPostAuthoritiesNotFound() *PostAuthoritiesNotFound {
	return &PostAuthoritiesNotFound{}
}

/*PostAuthoritiesNotFound handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostAuthoritiesUnprocessableEntity creates a PostAuthoritiesUnprocessableEntity with default headers values
func NewPostAuthoritiesUnprocessableEntity() *PostAuthoritiesUnprocessableEntity {
	return &PostAuthoritiesUnprocessableEntity{}
}

/*PostAuthoritiesUnprocessableEntity handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostAuthoritiesInternalServerError creates a PostAuthoritiesInternalServerError with default headers values
func NewPostAuthoritiesInternalServerError() *PostAuthoritiesInternalServerError {
	return &PostAuthoritiesInternalServerError{}
}

/*PostAuthoritiesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostAuthoritiesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

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

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