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

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

// GetGlBalancesReader is a Reader for the GetGlBalances structure.
type GetGlBalancesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetGlBalancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetGlBalancesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetGlBalancesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetGlBalancesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetGlBalancesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetGlBalancesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetGlBalancesInternalServerError()
		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())
	}
}

// NewGetGlBalancesOK creates a GetGlBalancesOK with default headers values
func NewGetGlBalancesOK() *GetGlBalancesOK {
	return &GetGlBalancesOK{}
}

/*GetGlBalancesOK handles this case with default header values.

Taxnexus Response with GL Account objects with Journal Items
*/
type GetGlBalancesOK struct {
	Payload *ledger_models.GlBalanceResponse
}

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

func (o *GetGlBalancesOK) GetPayload() *ledger_models.GlBalanceResponse {
	return o.Payload
}

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

	o.Payload = new(ledger_models.GlBalanceResponse)

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

	return nil
}

// NewGetGlBalancesUnauthorized creates a GetGlBalancesUnauthorized with default headers values
func NewGetGlBalancesUnauthorized() *GetGlBalancesUnauthorized {
	return &GetGlBalancesUnauthorized{}
}

/*GetGlBalancesUnauthorized handles this case with default header values.

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

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

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

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

// NewGetGlBalancesForbidden creates a GetGlBalancesForbidden with default headers values
func NewGetGlBalancesForbidden() *GetGlBalancesForbidden {
	return &GetGlBalancesForbidden{}
}

/*GetGlBalancesForbidden handles this case with default header values.

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

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

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

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

// NewGetGlBalancesNotFound creates a GetGlBalancesNotFound with default headers values
func NewGetGlBalancesNotFound() *GetGlBalancesNotFound {
	return &GetGlBalancesNotFound{}
}

/*GetGlBalancesNotFound handles this case with default header values.

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

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

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

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

// NewGetGlBalancesUnprocessableEntity creates a GetGlBalancesUnprocessableEntity with default headers values
func NewGetGlBalancesUnprocessableEntity() *GetGlBalancesUnprocessableEntity {
	return &GetGlBalancesUnprocessableEntity{}
}

/*GetGlBalancesUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewGetGlBalancesInternalServerError creates a GetGlBalancesInternalServerError with default headers values
func NewGetGlBalancesInternalServerError() *GetGlBalancesInternalServerError {
	return &GetGlBalancesInternalServerError{}
}

/*GetGlBalancesInternalServerError handles this case with default header values.

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

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

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

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