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

// PutInvoicesReader is a Reader for the PutInvoices structure.
type PutInvoicesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutInvoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutInvoicesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutInvoicesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutInvoicesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutInvoicesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutInvoicesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutInvoicesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /invoices] putInvoices", response, response.Code())
	}
}

// NewPutInvoicesOK creates a PutInvoicesOK with default headers values
func NewPutInvoicesOK() *PutInvoicesOK {
	return &PutInvoicesOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutInvoicesUnauthorized creates a PutInvoicesUnauthorized with default headers values
func NewPutInvoicesUnauthorized() *PutInvoicesUnauthorized {
	return &PutInvoicesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutInvoicesForbidden creates a PutInvoicesForbidden with default headers values
func NewPutInvoicesForbidden() *PutInvoicesForbidden {
	return &PutInvoicesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPutInvoicesNotFound creates a PutInvoicesNotFound with default headers values
func NewPutInvoicesNotFound() *PutInvoicesNotFound {
	return &PutInvoicesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutInvoicesUnprocessableEntity creates a PutInvoicesUnprocessableEntity with default headers values
func NewPutInvoicesUnprocessableEntity() *PutInvoicesUnprocessableEntity {
	return &PutInvoicesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutInvoicesInternalServerError creates a PutInvoicesInternalServerError with default headers values
func NewPutInvoicesInternalServerError() *PutInvoicesInternalServerError {
	return &PutInvoicesInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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