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

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

// PostGlAccountsReader is a Reader for the PostGlAccounts structure.
type PostGlAccountsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostGlAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostGlAccountsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostGlAccountsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostGlAccountsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostGlAccountsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostGlAccountsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostGlAccountsInternalServerError()
		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())
	}
}

// NewPostGlAccountsOK creates a PostGlAccountsOK with default headers values
func NewPostGlAccountsOK() *PostGlAccountsOK {
	return &PostGlAccountsOK{}
}

/*PostGlAccountsOK handles this case with default header values.

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

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

func (o *PostGlAccountsOK) GetPayload() *ledger_models.GlAccountResponse {
	return o.Payload
}

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

	o.Payload = new(ledger_models.GlAccountResponse)

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

	return nil
}

// NewPostGlAccountsUnauthorized creates a PostGlAccountsUnauthorized with default headers values
func NewPostGlAccountsUnauthorized() *PostGlAccountsUnauthorized {
	return &PostGlAccountsUnauthorized{}
}

/*PostGlAccountsUnauthorized handles this case with default header values.

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

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

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

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

// NewPostGlAccountsForbidden creates a PostGlAccountsForbidden with default headers values
func NewPostGlAccountsForbidden() *PostGlAccountsForbidden {
	return &PostGlAccountsForbidden{}
}

/*PostGlAccountsForbidden handles this case with default header values.

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

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

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

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

// NewPostGlAccountsNotFound creates a PostGlAccountsNotFound with default headers values
func NewPostGlAccountsNotFound() *PostGlAccountsNotFound {
	return &PostGlAccountsNotFound{}
}

/*PostGlAccountsNotFound handles this case with default header values.

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

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

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

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

// NewPostGlAccountsUnprocessableEntity creates a PostGlAccountsUnprocessableEntity with default headers values
func NewPostGlAccountsUnprocessableEntity() *PostGlAccountsUnprocessableEntity {
	return &PostGlAccountsUnprocessableEntity{}
}

/*PostGlAccountsUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewPostGlAccountsInternalServerError creates a PostGlAccountsInternalServerError with default headers values
func NewPostGlAccountsInternalServerError() *PostGlAccountsInternalServerError {
	return &PostGlAccountsInternalServerError{}
}

/*PostGlAccountsInternalServerError handles this case with default header values.

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

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

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

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