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

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

// PostAccountingRulesReader is a Reader for the PostAccountingRules structure.
type PostAccountingRulesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostAccountingRulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostAccountingRulesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostAccountingRulesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostAccountingRulesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostAccountingRulesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostAccountingRulesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostAccountingRulesInternalServerError()
		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())
	}
}

// NewPostAccountingRulesOK creates a PostAccountingRulesOK with default headers values
func NewPostAccountingRulesOK() *PostAccountingRulesOK {
	return &PostAccountingRulesOK{}
}

/*PostAccountingRulesOK handles this case with default header values.

Taxnexus Response with Accounting Rule objects
*/
type PostAccountingRulesOK struct {
	Payload *ledger_models.AccountingRuleResponse
}

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

func (o *PostAccountingRulesOK) GetPayload() *ledger_models.AccountingRuleResponse {
	return o.Payload
}

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

	o.Payload = new(ledger_models.AccountingRuleResponse)

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

	return nil
}

// NewPostAccountingRulesUnauthorized creates a PostAccountingRulesUnauthorized with default headers values
func NewPostAccountingRulesUnauthorized() *PostAccountingRulesUnauthorized {
	return &PostAccountingRulesUnauthorized{}
}

/*PostAccountingRulesUnauthorized handles this case with default header values.

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

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

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

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

// NewPostAccountingRulesForbidden creates a PostAccountingRulesForbidden with default headers values
func NewPostAccountingRulesForbidden() *PostAccountingRulesForbidden {
	return &PostAccountingRulesForbidden{}
}

/*PostAccountingRulesForbidden handles this case with default header values.

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

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

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

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

// NewPostAccountingRulesNotFound creates a PostAccountingRulesNotFound with default headers values
func NewPostAccountingRulesNotFound() *PostAccountingRulesNotFound {
	return &PostAccountingRulesNotFound{}
}

/*PostAccountingRulesNotFound handles this case with default header values.

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

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

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

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

// NewPostAccountingRulesUnprocessableEntity creates a PostAccountingRulesUnprocessableEntity with default headers values
func NewPostAccountingRulesUnprocessableEntity() *PostAccountingRulesUnprocessableEntity {
	return &PostAccountingRulesUnprocessableEntity{}
}

/*PostAccountingRulesUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewPostAccountingRulesInternalServerError creates a PostAccountingRulesInternalServerError with default headers values
func NewPostAccountingRulesInternalServerError() *PostAccountingRulesInternalServerError {
	return &PostAccountingRulesInternalServerError{}
}

/*PostAccountingRulesInternalServerError handles this case with default header values.

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

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

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

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