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

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

// PostTaxnexusCodesReader is a Reader for the PostTaxnexusCodes structure.
type PostTaxnexusCodesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTaxnexusCodesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostTaxnexusCodesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostTaxnexusCodesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostTaxnexusCodesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostTaxnexusCodesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostTaxnexusCodesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostTaxnexusCodesInternalServerError()
		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())
	}
}

// NewPostTaxnexusCodesOK creates a PostTaxnexusCodesOK with default headers values
func NewPostTaxnexusCodesOK() *PostTaxnexusCodesOK {
	return &PostTaxnexusCodesOK{}
}

/*PostTaxnexusCodesOK handles this case with default header values.

Taxnexus Response with an array of Taxnexus Codes
*/
type PostTaxnexusCodesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.TaxnexusCodeResponse
}

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

func (o *PostTaxnexusCodesOK) GetPayload() *geo_models.TaxnexusCodeResponse {
	return o.Payload
}

func (o *PostTaxnexusCodesOK) 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.TaxnexusCodeResponse)

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

	return nil
}

// NewPostTaxnexusCodesUnauthorized creates a PostTaxnexusCodesUnauthorized with default headers values
func NewPostTaxnexusCodesUnauthorized() *PostTaxnexusCodesUnauthorized {
	return &PostTaxnexusCodesUnauthorized{}
}

/*PostTaxnexusCodesUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxnexusCodesForbidden creates a PostTaxnexusCodesForbidden with default headers values
func NewPostTaxnexusCodesForbidden() *PostTaxnexusCodesForbidden {
	return &PostTaxnexusCodesForbidden{}
}

/*PostTaxnexusCodesForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxnexusCodesNotFound creates a PostTaxnexusCodesNotFound with default headers values
func NewPostTaxnexusCodesNotFound() *PostTaxnexusCodesNotFound {
	return &PostTaxnexusCodesNotFound{}
}

/*PostTaxnexusCodesNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxnexusCodesUnprocessableEntity creates a PostTaxnexusCodesUnprocessableEntity with default headers values
func NewPostTaxnexusCodesUnprocessableEntity() *PostTaxnexusCodesUnprocessableEntity {
	return &PostTaxnexusCodesUnprocessableEntity{}
}

/*PostTaxnexusCodesUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxnexusCodesInternalServerError creates a PostTaxnexusCodesInternalServerError with default headers values
func NewPostTaxnexusCodesInternalServerError() *PostTaxnexusCodesInternalServerError {
	return &PostTaxnexusCodesInternalServerError{}
}

/*PostTaxnexusCodesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostTaxnexusCodesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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