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

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

// GetCoasReader is a Reader for the GetCoas structure.
type GetCoasReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCoasReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCoasOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCoasUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCoasForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCoasNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCoasUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCoasInternalServerError()
		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())
	}
}

// NewGetCoasOK creates a GetCoasOK with default headers values
func NewGetCoasOK() *GetCoasOK {
	return &GetCoasOK{}
}

/*GetCoasOK handles this case with default header values.

Taxnexus Response with Chart of Accounts objects
*/
type GetCoasOK struct {
	Payload *ledger_models.CoaResponse
}

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

func (o *GetCoasOK) GetPayload() *ledger_models.CoaResponse {
	return o.Payload
}

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

	o.Payload = new(ledger_models.CoaResponse)

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

	return nil
}

// NewGetCoasUnauthorized creates a GetCoasUnauthorized with default headers values
func NewGetCoasUnauthorized() *GetCoasUnauthorized {
	return &GetCoasUnauthorized{}
}

/*GetCoasUnauthorized handles this case with default header values.

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

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

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

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

// NewGetCoasForbidden creates a GetCoasForbidden with default headers values
func NewGetCoasForbidden() *GetCoasForbidden {
	return &GetCoasForbidden{}
}

/*GetCoasForbidden handles this case with default header values.

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

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

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

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

// NewGetCoasNotFound creates a GetCoasNotFound with default headers values
func NewGetCoasNotFound() *GetCoasNotFound {
	return &GetCoasNotFound{}
}

/*GetCoasNotFound handles this case with default header values.

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

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

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

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

// NewGetCoasUnprocessableEntity creates a GetCoasUnprocessableEntity with default headers values
func NewGetCoasUnprocessableEntity() *GetCoasUnprocessableEntity {
	return &GetCoasUnprocessableEntity{}
}

/*GetCoasUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewGetCoasInternalServerError creates a GetCoasInternalServerError with default headers values
func NewGetCoasInternalServerError() *GetCoasInternalServerError {
	return &GetCoasInternalServerError{}
}

/*GetCoasInternalServerError handles this case with default header values.

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

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

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

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