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

// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package invoices

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

	"code.tnxs.net/work/lib/api/members/members_models"
)

// PostInvoicesReader is a Reader for the PostInvoices structure.
type PostInvoicesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostInvoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostInvoicesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostInvoicesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostInvoicesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostInvoicesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostInvoicesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostInvoicesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewPostInvoicesOK creates a PostInvoicesOK with default headers values
func NewPostInvoicesOK() *PostInvoicesOK {
	return &PostInvoicesOK{}
}

/*
PostInvoicesOK describes a response with status code 200, with default header values.

Invoice Response Object
*/
type PostInvoicesOK struct {
	Payload *members_models.InvoiceResponse
}

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

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

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

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

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

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

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

func (o *PostInvoicesOK) String() string {
	return fmt.Sprintf("[POST /invoices][%d] postInvoicesOK  %+v", 200, o.Payload)
}

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

func (o *PostInvoicesOK) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostInvoicesUnauthorized creates a PostInvoicesUnauthorized with default headers values
func NewPostInvoicesUnauthorized() *PostInvoicesUnauthorized {
	return &PostInvoicesUnauthorized{}
}

/*
PostInvoicesUnauthorized describes a response with status code 401, with default header values.

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

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

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

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

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

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

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

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

func (o *PostInvoicesUnauthorized) String() string {
	return fmt.Sprintf("[POST /invoices][%d] postInvoicesUnauthorized  %+v", 401, o.Payload)
}

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

func (o *PostInvoicesUnauthorized) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostInvoicesForbidden creates a PostInvoicesForbidden with default headers values
func NewPostInvoicesForbidden() *PostInvoicesForbidden {
	return &PostInvoicesForbidden{}
}

/*
PostInvoicesForbidden describes a response with status code 403, with default header values.

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

func (o *PostInvoicesForbidden) String() string {
	return fmt.Sprintf("[POST /invoices][%d] postInvoicesForbidden  %+v", 403, o.Payload)
}

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

func (o *PostInvoicesForbidden) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostInvoicesNotFound creates a PostInvoicesNotFound with default headers values
func NewPostInvoicesNotFound() *PostInvoicesNotFound {
	return &PostInvoicesNotFound{}
}

/*
PostInvoicesNotFound describes a response with status code 404, with default header values.

Resource was not found
*/
type PostInvoicesNotFound struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

func (o *PostInvoicesNotFound) String() string {
	return fmt.Sprintf("[POST /invoices][%d] postInvoicesNotFound  %+v", 404, o.Payload)
}

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

func (o *PostInvoicesNotFound) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostInvoicesUnprocessableEntity creates a PostInvoicesUnprocessableEntity with default headers values
func NewPostInvoicesUnprocessableEntity() *PostInvoicesUnprocessableEntity {
	return &PostInvoicesUnprocessableEntity{}
}

/*
PostInvoicesUnprocessableEntity describes a response with status code 422, with default header values.

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

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

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

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

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

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

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

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

func (o *PostInvoicesUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /invoices][%d] postInvoicesUnprocessableEntity  %+v", 422, o.Payload)
}

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

func (o *PostInvoicesUnprocessableEntity) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostInvoicesInternalServerError creates a PostInvoicesInternalServerError with default headers values
func NewPostInvoicesInternalServerError() *PostInvoicesInternalServerError {
	return &PostInvoicesInternalServerError{}
}

/*
PostInvoicesInternalServerError describes a response with status code 500, with default header values.

Server Internal Error
*/
type PostInvoicesInternalServerError struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

func (o *PostInvoicesInternalServerError) String() string {
	return fmt.Sprintf("[POST /invoices][%d] postInvoicesInternalServerError  %+v", 500, o.Payload)
}

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

func (o *PostInvoicesInternalServerError) 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 && err != io.EOF {
		return err
	}

	return nil
}
