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

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

// GetJournalItemsReader is a Reader for the GetJournalItems structure.
type GetJournalItemsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetJournalItemsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetJournalItemsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetJournalItemsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetJournalItemsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetJournalItemsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetJournalItemsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetJournalItemsInternalServerError()
		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())
	}
}

// NewGetJournalItemsOK creates a GetJournalItemsOK with default headers values
func NewGetJournalItemsOK() *GetJournalItemsOK {
	return &GetJournalItemsOK{}
}

/*GetJournalItemsOK handles this case with default header values.

Taxnexus Response with Journal Item objects
*/
type GetJournalItemsOK struct {
	Payload *ledger_models.JournalItemSummaryResponse
}

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

func (o *GetJournalItemsOK) GetPayload() *ledger_models.JournalItemSummaryResponse {
	return o.Payload
}

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

	o.Payload = new(ledger_models.JournalItemSummaryResponse)

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

	return nil
}

// NewGetJournalItemsUnauthorized creates a GetJournalItemsUnauthorized with default headers values
func NewGetJournalItemsUnauthorized() *GetJournalItemsUnauthorized {
	return &GetJournalItemsUnauthorized{}
}

/*GetJournalItemsUnauthorized handles this case with default header values.

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

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

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

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

// NewGetJournalItemsForbidden creates a GetJournalItemsForbidden with default headers values
func NewGetJournalItemsForbidden() *GetJournalItemsForbidden {
	return &GetJournalItemsForbidden{}
}

/*GetJournalItemsForbidden handles this case with default header values.

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

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

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

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

// NewGetJournalItemsNotFound creates a GetJournalItemsNotFound with default headers values
func NewGetJournalItemsNotFound() *GetJournalItemsNotFound {
	return &GetJournalItemsNotFound{}
}

/*GetJournalItemsNotFound handles this case with default header values.

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

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

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

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

// NewGetJournalItemsUnprocessableEntity creates a GetJournalItemsUnprocessableEntity with default headers values
func NewGetJournalItemsUnprocessableEntity() *GetJournalItemsUnprocessableEntity {
	return &GetJournalItemsUnprocessableEntity{}
}

/*GetJournalItemsUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewGetJournalItemsInternalServerError creates a GetJournalItemsInternalServerError with default headers values
func NewGetJournalItemsInternalServerError() *GetJournalItemsInternalServerError {
	return &GetJournalItemsInternalServerError{}
}

/*GetJournalItemsInternalServerError handles this case with default header values.

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

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

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

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