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

// GetAccountingRulesReader is a Reader for the GetAccountingRules structure.
type GetAccountingRulesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetAccountingRulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetAccountingRulesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetAccountingRulesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetAccountingRulesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetAccountingRulesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetAccountingRulesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetAccountingRulesInternalServerError()
		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())
	}
}

// NewGetAccountingRulesOK creates a GetAccountingRulesOK with default headers values
func NewGetAccountingRulesOK() *GetAccountingRulesOK {
	return &GetAccountingRulesOK{}
}

/*GetAccountingRulesOK handles this case with default header values.

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

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

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

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

// NewGetAccountingRulesUnauthorized creates a GetAccountingRulesUnauthorized with default headers values
func NewGetAccountingRulesUnauthorized() *GetAccountingRulesUnauthorized {
	return &GetAccountingRulesUnauthorized{}
}

/*GetAccountingRulesUnauthorized handles this case with default header values.

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

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

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

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

// NewGetAccountingRulesForbidden creates a GetAccountingRulesForbidden with default headers values
func NewGetAccountingRulesForbidden() *GetAccountingRulesForbidden {
	return &GetAccountingRulesForbidden{}
}

/*GetAccountingRulesForbidden handles this case with default header values.

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

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

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

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

// NewGetAccountingRulesNotFound creates a GetAccountingRulesNotFound with default headers values
func NewGetAccountingRulesNotFound() *GetAccountingRulesNotFound {
	return &GetAccountingRulesNotFound{}
}

/*GetAccountingRulesNotFound handles this case with default header values.

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

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

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

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

// NewGetAccountingRulesUnprocessableEntity creates a GetAccountingRulesUnprocessableEntity with default headers values
func NewGetAccountingRulesUnprocessableEntity() *GetAccountingRulesUnprocessableEntity {
	return &GetAccountingRulesUnprocessableEntity{}
}

/*GetAccountingRulesUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewGetAccountingRulesInternalServerError creates a GetAccountingRulesInternalServerError with default headers values
func NewGetAccountingRulesInternalServerError() *GetAccountingRulesInternalServerError {
	return &GetAccountingRulesInternalServerError{}
}

/*GetAccountingRulesInternalServerError handles this case with default header values.

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

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

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

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