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

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

// PostTaxTypesReader is a Reader for the PostTaxTypes structure.
type PostTaxTypesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTaxTypesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostTaxTypesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostTaxTypesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostTaxTypesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostTaxTypesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostTaxTypesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostTaxTypesInternalServerError()
		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())
	}
}

// NewPostTaxTypesOK creates a PostTaxTypesOK with default headers values
func NewPostTaxTypesOK() *PostTaxTypesOK {
	return &PostTaxTypesOK{}
}

/*PostTaxTypesOK handles this case with default header values.

Taxnexus Response with an array of Tax Type objects
*/
type PostTaxTypesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.TaxTypeResponse
}

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

func (o *PostTaxTypesOK) GetPayload() *geo_models.TaxTypeResponse {
	return o.Payload
}

func (o *PostTaxTypesOK) 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.TaxTypeResponse)

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

	return nil
}

// NewPostTaxTypesUnauthorized creates a PostTaxTypesUnauthorized with default headers values
func NewPostTaxTypesUnauthorized() *PostTaxTypesUnauthorized {
	return &PostTaxTypesUnauthorized{}
}

/*PostTaxTypesUnauthorized handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxTypesForbidden creates a PostTaxTypesForbidden with default headers values
func NewPostTaxTypesForbidden() *PostTaxTypesForbidden {
	return &PostTaxTypesForbidden{}
}

/*PostTaxTypesForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxTypesNotFound creates a PostTaxTypesNotFound with default headers values
func NewPostTaxTypesNotFound() *PostTaxTypesNotFound {
	return &PostTaxTypesNotFound{}
}

/*PostTaxTypesNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxTypesUnprocessableEntity creates a PostTaxTypesUnprocessableEntity with default headers values
func NewPostTaxTypesUnprocessableEntity() *PostTaxTypesUnprocessableEntity {
	return &PostTaxTypesUnprocessableEntity{}
}

/*PostTaxTypesUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

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

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

// NewPostTaxTypesInternalServerError creates a PostTaxTypesInternalServerError with default headers values
func NewPostTaxTypesInternalServerError() *PostTaxTypesInternalServerError {
	return &PostTaxTypesInternalServerError{}
}

/*PostTaxTypesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostTaxTypesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

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

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