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

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

// PostJournalEntriesReader is a Reader for the PostJournalEntries structure.
type PostJournalEntriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostJournalEntriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostJournalEntriesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostJournalEntriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostJournalEntriesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostJournalEntriesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostJournalEntriesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostJournalEntriesInternalServerError()
		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())
	}
}

// NewPostJournalEntriesOK creates a PostJournalEntriesOK with default headers values
func NewPostJournalEntriesOK() *PostJournalEntriesOK {
	return &PostJournalEntriesOK{}
}

/*PostJournalEntriesOK handles this case with default header values.

Taxnexus Response with Journal Entry objects with Journal Items
*/
type PostJournalEntriesOK struct {
	Payload *ledger_models.JournalEntryResponse
}

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

func (o *PostJournalEntriesOK) GetPayload() *ledger_models.JournalEntryResponse {
	return o.Payload
}

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

	o.Payload = new(ledger_models.JournalEntryResponse)

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

	return nil
}

// NewPostJournalEntriesUnauthorized creates a PostJournalEntriesUnauthorized with default headers values
func NewPostJournalEntriesUnauthorized() *PostJournalEntriesUnauthorized {
	return &PostJournalEntriesUnauthorized{}
}

/*PostJournalEntriesUnauthorized handles this case with default header values.

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

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

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

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

// NewPostJournalEntriesForbidden creates a PostJournalEntriesForbidden with default headers values
func NewPostJournalEntriesForbidden() *PostJournalEntriesForbidden {
	return &PostJournalEntriesForbidden{}
}

/*PostJournalEntriesForbidden handles this case with default header values.

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

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

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

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

// NewPostJournalEntriesNotFound creates a PostJournalEntriesNotFound with default headers values
func NewPostJournalEntriesNotFound() *PostJournalEntriesNotFound {
	return &PostJournalEntriesNotFound{}
}

/*PostJournalEntriesNotFound handles this case with default header values.

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

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

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

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

// NewPostJournalEntriesUnprocessableEntity creates a PostJournalEntriesUnprocessableEntity with default headers values
func NewPostJournalEntriesUnprocessableEntity() *PostJournalEntriesUnprocessableEntity {
	return &PostJournalEntriesUnprocessableEntity{}
}

/*PostJournalEntriesUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewPostJournalEntriesInternalServerError creates a PostJournalEntriesInternalServerError with default headers values
func NewPostJournalEntriesInternalServerError() *PostJournalEntriesInternalServerError {
	return &PostJournalEntriesInternalServerError{}
}

/*PostJournalEntriesInternalServerError handles this case with default header values.

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

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

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

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