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

// PostGlBalancesReader is a Reader for the PostGlBalances structure.
type PostGlBalancesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostGlBalancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostGlBalancesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostGlBalancesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostGlBalancesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostGlBalancesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostGlBalancesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostGlBalancesInternalServerError()
		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())
	}
}

// NewPostGlBalancesOK creates a PostGlBalancesOK with default headers values
func NewPostGlBalancesOK() *PostGlBalancesOK {
	return &PostGlBalancesOK{}
}

/*PostGlBalancesOK handles this case with default header values.

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

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

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

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

// NewPostGlBalancesUnauthorized creates a PostGlBalancesUnauthorized with default headers values
func NewPostGlBalancesUnauthorized() *PostGlBalancesUnauthorized {
	return &PostGlBalancesUnauthorized{}
}

/*PostGlBalancesUnauthorized handles this case with default header values.

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

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

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

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

// NewPostGlBalancesForbidden creates a PostGlBalancesForbidden with default headers values
func NewPostGlBalancesForbidden() *PostGlBalancesForbidden {
	return &PostGlBalancesForbidden{}
}

/*PostGlBalancesForbidden handles this case with default header values.

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

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

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

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

// NewPostGlBalancesNotFound creates a PostGlBalancesNotFound with default headers values
func NewPostGlBalancesNotFound() *PostGlBalancesNotFound {
	return &PostGlBalancesNotFound{}
}

/*PostGlBalancesNotFound handles this case with default header values.

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

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

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

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

// NewPostGlBalancesUnprocessableEntity creates a PostGlBalancesUnprocessableEntity with default headers values
func NewPostGlBalancesUnprocessableEntity() *PostGlBalancesUnprocessableEntity {
	return &PostGlBalancesUnprocessableEntity{}
}

/*PostGlBalancesUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewPostGlBalancesInternalServerError creates a PostGlBalancesInternalServerError with default headers values
func NewPostGlBalancesInternalServerError() *PostGlBalancesInternalServerError {
	return &PostGlBalancesInternalServerError{}
}

/*PostGlBalancesInternalServerError handles this case with default header values.

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

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

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

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