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

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

// PostTransactionsReader is a Reader for the PostTransactions structure.
type PostTransactionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTransactionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostTransactionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostTransactionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostTransactionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostTransactionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostTransactionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostTransactionsInternalServerError()
		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())
	}
}

// NewPostTransactionsOK creates a PostTransactionsOK with default headers values
func NewPostTransactionsOK() *PostTransactionsOK {
	return &PostTransactionsOK{}
}

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

Transaction Response Object
*/
type PostTransactionsOK struct {
	Payload *members_models.TransactionResponse
}

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

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

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

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

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

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

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

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

func (o *PostTransactionsOK) GetPayload() *members_models.TransactionResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.TransactionResponse)

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

	return nil
}

// NewPostTransactionsUnauthorized creates a PostTransactionsUnauthorized with default headers values
func NewPostTransactionsUnauthorized() *PostTransactionsUnauthorized {
	return &PostTransactionsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostTransactionsForbidden creates a PostTransactionsForbidden with default headers values
func NewPostTransactionsForbidden() *PostTransactionsForbidden {
	return &PostTransactionsForbidden{}
}

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

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostTransactionsNotFound creates a PostTransactionsNotFound with default headers values
func NewPostTransactionsNotFound() *PostTransactionsNotFound {
	return &PostTransactionsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostTransactionsUnprocessableEntity creates a PostTransactionsUnprocessableEntity with default headers values
func NewPostTransactionsUnprocessableEntity() *PostTransactionsUnprocessableEntity {
	return &PostTransactionsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostTransactionsInternalServerError creates a PostTransactionsInternalServerError with default headers values
func NewPostTransactionsInternalServerError() *PostTransactionsInternalServerError {
	return &PostTransactionsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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