// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package invoices

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// GetInvoicesReader is a Reader for the GetInvoices structure.
type GetInvoicesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetInvoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetInvoicesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetInvoicesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetInvoicesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetInvoicesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetInvoicesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetInvoicesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /invoices] getInvoices", response, response.Code())
	}
}

// NewGetInvoicesOK creates a GetInvoicesOK with default headers values
func NewGetInvoicesOK() *GetInvoicesOK {
	return &GetInvoicesOK{}
}

// GetInvoicesOK describes a response with status code 200, with default header values.
//
// Invoice Response Object
type GetInvoicesOK struct {
	Payload *members_models.InvoiceResponse
}

// IsSuccess returns true when this get invoices o k response has a 2xx status code
func (o *GetInvoicesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get invoices o k response has a 3xx status code
func (o *GetInvoicesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get invoices o k response has a 4xx status code
func (o *GetInvoicesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get invoices o k response has a 5xx status code
func (o *GetInvoicesOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get invoices o k response a status code equal to that given
func (o *GetInvoicesOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get invoices o k response
func (o *GetInvoicesOK) Code() int {
	return 200
}

func (o *GetInvoicesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesOK %s", 200, payload)
}

func (o *GetInvoicesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesOK %s", 200, payload)
}

func (o *GetInvoicesOK) GetPayload() *members_models.InvoiceResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.InvoiceResponse)

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

	return nil
}

// NewGetInvoicesUnauthorized creates a GetInvoicesUnauthorized with default headers values
func NewGetInvoicesUnauthorized() *GetInvoicesUnauthorized {
	return &GetInvoicesUnauthorized{}
}

// GetInvoicesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type GetInvoicesUnauthorized struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get invoices unauthorized response has a 2xx status code
func (o *GetInvoicesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get invoices unauthorized response has a 3xx status code
func (o *GetInvoicesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get invoices unauthorized response has a 4xx status code
func (o *GetInvoicesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get invoices unauthorized response has a 5xx status code
func (o *GetInvoicesUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get invoices unauthorized response a status code equal to that given
func (o *GetInvoicesUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get invoices unauthorized response
func (o *GetInvoicesUnauthorized) Code() int {
	return 401
}

func (o *GetInvoicesUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnauthorized %s", 401, payload)
}

func (o *GetInvoicesUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnauthorized %s", 401, payload)
}

func (o *GetInvoicesUnauthorized) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetInvoicesForbidden creates a GetInvoicesForbidden with default headers values
func NewGetInvoicesForbidden() *GetInvoicesForbidden {
	return &GetInvoicesForbidden{}
}

// GetInvoicesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type GetInvoicesForbidden struct {
	AccessControlAllowOrigin string

	Payload *members_models.Error
}

// IsSuccess returns true when this get invoices forbidden response has a 2xx status code
func (o *GetInvoicesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get invoices forbidden response has a 3xx status code
func (o *GetInvoicesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get invoices forbidden response has a 4xx status code
func (o *GetInvoicesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get invoices forbidden response has a 5xx status code
func (o *GetInvoicesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get invoices forbidden response a status code equal to that given
func (o *GetInvoicesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get invoices forbidden response
func (o *GetInvoicesForbidden) Code() int {
	return 403
}

func (o *GetInvoicesForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesForbidden %s", 403, payload)
}

func (o *GetInvoicesForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesForbidden %s", 403, payload)
}

func (o *GetInvoicesForbidden) GetPayload() *members_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetInvoicesNotFound creates a GetInvoicesNotFound with default headers values
func NewGetInvoicesNotFound() *GetInvoicesNotFound {
	return &GetInvoicesNotFound{}
}

// GetInvoicesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type GetInvoicesNotFound struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get invoices not found response has a 2xx status code
func (o *GetInvoicesNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get invoices not found response has a 3xx status code
func (o *GetInvoicesNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get invoices not found response has a 4xx status code
func (o *GetInvoicesNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this get invoices not found response has a 5xx status code
func (o *GetInvoicesNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this get invoices not found response a status code equal to that given
func (o *GetInvoicesNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the get invoices not found response
func (o *GetInvoicesNotFound) Code() int {
	return 404
}

func (o *GetInvoicesNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesNotFound %s", 404, payload)
}

func (o *GetInvoicesNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesNotFound %s", 404, payload)
}

func (o *GetInvoicesNotFound) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetInvoicesUnprocessableEntity creates a GetInvoicesUnprocessableEntity with default headers values
func NewGetInvoicesUnprocessableEntity() *GetInvoicesUnprocessableEntity {
	return &GetInvoicesUnprocessableEntity{}
}

// GetInvoicesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type GetInvoicesUnprocessableEntity struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get invoices unprocessable entity response has a 2xx status code
func (o *GetInvoicesUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get invoices unprocessable entity response has a 3xx status code
func (o *GetInvoicesUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get invoices unprocessable entity response has a 4xx status code
func (o *GetInvoicesUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this get invoices unprocessable entity response has a 5xx status code
func (o *GetInvoicesUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this get invoices unprocessable entity response a status code equal to that given
func (o *GetInvoicesUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the get invoices unprocessable entity response
func (o *GetInvoicesUnprocessableEntity) Code() int {
	return 422
}

func (o *GetInvoicesUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnprocessableEntity %s", 422, payload)
}

func (o *GetInvoicesUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnprocessableEntity %s", 422, payload)
}

func (o *GetInvoicesUnprocessableEntity) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetInvoicesInternalServerError creates a GetInvoicesInternalServerError with default headers values
func NewGetInvoicesInternalServerError() *GetInvoicesInternalServerError {
	return &GetInvoicesInternalServerError{}
}

// GetInvoicesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type GetInvoicesInternalServerError struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get invoices internal server error response has a 2xx status code
func (o *GetInvoicesInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get invoices internal server error response has a 3xx status code
func (o *GetInvoicesInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get invoices internal server error response has a 4xx status code
func (o *GetInvoicesInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get invoices internal server error response has a 5xx status code
func (o *GetInvoicesInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get invoices internal server error response a status code equal to that given
func (o *GetInvoicesInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get invoices internal server error response
func (o *GetInvoicesInternalServerError) Code() int {
	return 500
}

func (o *GetInvoicesInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesInternalServerError %s", 500, payload)
}

func (o *GetInvoicesInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /invoices][%d] getInvoicesInternalServerError %s", 500, payload)
}

func (o *GetInvoicesInternalServerError) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}
