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

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

// PostAccountingRulesetsReader is a Reader for the PostAccountingRulesets structure.
type PostAccountingRulesetsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostAccountingRulesetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostAccountingRulesetsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostAccountingRulesetsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostAccountingRulesetsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostAccountingRulesetsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostAccountingRulesetsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostAccountingRulesetsInternalServerError()
		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())
	}
}

// NewPostAccountingRulesetsOK creates a PostAccountingRulesetsOK with default headers values
func NewPostAccountingRulesetsOK() *PostAccountingRulesetsOK {
	return &PostAccountingRulesetsOK{}
}

/*PostAccountingRulesetsOK handles this case with default header values.

Taxnexus Response with Accounting Ruleset objects
*/
type PostAccountingRulesetsOK struct {
	Payload *ledger_models.AccountingRulesetResponse
}

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

func (o *PostAccountingRulesetsOK) GetPayload() *ledger_models.AccountingRulesetResponse {
	return o.Payload
}

func (o *PostAccountingRulesetsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(ledger_models.AccountingRulesetResponse)

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

	return nil
}

// NewPostAccountingRulesetsUnauthorized creates a PostAccountingRulesetsUnauthorized with default headers values
func NewPostAccountingRulesetsUnauthorized() *PostAccountingRulesetsUnauthorized {
	return &PostAccountingRulesetsUnauthorized{}
}

/*PostAccountingRulesetsUnauthorized handles this case with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type PostAccountingRulesetsUnauthorized struct {
	Payload *ledger_models.Error
}

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

func (o *PostAccountingRulesetsUnauthorized) GetPayload() *ledger_models.Error {
	return o.Payload
}

func (o *PostAccountingRulesetsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(ledger_models.Error)

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

	return nil
}

// NewPostAccountingRulesetsForbidden creates a PostAccountingRulesetsForbidden with default headers values
func NewPostAccountingRulesetsForbidden() *PostAccountingRulesetsForbidden {
	return &PostAccountingRulesetsForbidden{}
}

/*PostAccountingRulesetsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PostAccountingRulesetsForbidden struct {
	Payload *ledger_models.Error
}

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

func (o *PostAccountingRulesetsForbidden) GetPayload() *ledger_models.Error {
	return o.Payload
}

func (o *PostAccountingRulesetsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(ledger_models.Error)

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

	return nil
}

// NewPostAccountingRulesetsNotFound creates a PostAccountingRulesetsNotFound with default headers values
func NewPostAccountingRulesetsNotFound() *PostAccountingRulesetsNotFound {
	return &PostAccountingRulesetsNotFound{}
}

/*PostAccountingRulesetsNotFound handles this case with default header values.

Resource was not found
*/
type PostAccountingRulesetsNotFound struct {
	Payload *ledger_models.Error
}

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

func (o *PostAccountingRulesetsNotFound) GetPayload() *ledger_models.Error {
	return o.Payload
}

func (o *PostAccountingRulesetsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(ledger_models.Error)

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

	return nil
}

// NewPostAccountingRulesetsUnprocessableEntity creates a PostAccountingRulesetsUnprocessableEntity with default headers values
func NewPostAccountingRulesetsUnprocessableEntity() *PostAccountingRulesetsUnprocessableEntity {
	return &PostAccountingRulesetsUnprocessableEntity{}
}

/*PostAccountingRulesetsUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostAccountingRulesetsUnprocessableEntity struct {
	Payload *ledger_models.Error
}

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

func (o *PostAccountingRulesetsUnprocessableEntity) GetPayload() *ledger_models.Error {
	return o.Payload
}

func (o *PostAccountingRulesetsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(ledger_models.Error)

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

	return nil
}

// NewPostAccountingRulesetsInternalServerError creates a PostAccountingRulesetsInternalServerError with default headers values
func NewPostAccountingRulesetsInternalServerError() *PostAccountingRulesetsInternalServerError {
	return &PostAccountingRulesetsInternalServerError{}
}

/*PostAccountingRulesetsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostAccountingRulesetsInternalServerError struct {
	Payload *ledger_models.Error
}

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

func (o *PostAccountingRulesetsInternalServerError) GetPayload() *ledger_models.Error {
	return o.Payload
}

func (o *PostAccountingRulesetsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(ledger_models.Error)

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

	return nil
}
