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

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

// GetRenderInvoiceReader is a Reader for the GetRenderInvoice structure.
type GetRenderInvoiceReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetRenderInvoiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetRenderInvoiceOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetRenderInvoiceUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetRenderInvoiceForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetRenderInvoiceNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetRenderInvoiceUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetRenderInvoiceInternalServerError()
		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())
	}
}

// NewGetRenderInvoiceOK creates a GetRenderInvoiceOK with default headers values
func NewGetRenderInvoiceOK() *GetRenderInvoiceOK {
	return &GetRenderInvoiceOK{}
}

/*GetRenderInvoiceOK handles this case with default header values.

Rendered documents response
*/
type GetRenderInvoiceOK struct {
	AccessControlAllowOrigin string

	Payload *render_models.DocumentResponse
}

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

func (o *GetRenderInvoiceOK) GetPayload() *render_models.DocumentResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(render_models.DocumentResponse)

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

	return nil
}

// NewGetRenderInvoiceUnauthorized creates a GetRenderInvoiceUnauthorized with default headers values
func NewGetRenderInvoiceUnauthorized() *GetRenderInvoiceUnauthorized {
	return &GetRenderInvoiceUnauthorized{}
}

/*GetRenderInvoiceUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type GetRenderInvoiceUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *render_models.Error
}

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

func (o *GetRenderInvoiceUnauthorized) GetPayload() *render_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(render_models.Error)

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

	return nil
}

// NewGetRenderInvoiceForbidden creates a GetRenderInvoiceForbidden with default headers values
func NewGetRenderInvoiceForbidden() *GetRenderInvoiceForbidden {
	return &GetRenderInvoiceForbidden{}
}

/*GetRenderInvoiceForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetRenderInvoiceForbidden struct {
	AccessControlAllowOrigin string

	Payload *render_models.Error
}

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

func (o *GetRenderInvoiceForbidden) GetPayload() *render_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(render_models.Error)

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

	return nil
}

// NewGetRenderInvoiceNotFound creates a GetRenderInvoiceNotFound with default headers values
func NewGetRenderInvoiceNotFound() *GetRenderInvoiceNotFound {
	return &GetRenderInvoiceNotFound{}
}

/*GetRenderInvoiceNotFound handles this case with default header values.

Resource was not found
*/
type GetRenderInvoiceNotFound struct {
	AccessControlAllowOrigin string

	Payload *render_models.Error
}

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

func (o *GetRenderInvoiceNotFound) GetPayload() *render_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(render_models.Error)

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

	return nil
}

// NewGetRenderInvoiceUnprocessableEntity creates a GetRenderInvoiceUnprocessableEntity with default headers values
func NewGetRenderInvoiceUnprocessableEntity() *GetRenderInvoiceUnprocessableEntity {
	return &GetRenderInvoiceUnprocessableEntity{}
}

/*GetRenderInvoiceUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type GetRenderInvoiceUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *render_models.Error
}

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

func (o *GetRenderInvoiceUnprocessableEntity) GetPayload() *render_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(render_models.Error)

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

	return nil
}

// NewGetRenderInvoiceInternalServerError creates a GetRenderInvoiceInternalServerError with default headers values
func NewGetRenderInvoiceInternalServerError() *GetRenderInvoiceInternalServerError {
	return &GetRenderInvoiceInternalServerError{}
}

/*GetRenderInvoiceInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetRenderInvoiceInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *render_models.Error
}

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

func (o *GetRenderInvoiceInternalServerError) GetPayload() *render_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(render_models.Error)

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

	return nil
}
