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

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

// PutTransactionsReader is a Reader for the PutTransactions structure.
type PutTransactionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutTransactionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutTransactionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutTransactionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutTransactionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutTransactionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutTransactionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutTransactionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /transactions] putTransactions", response, response.Code())
	}
}

// NewPutTransactionsOK creates a PutTransactionsOK with default headers values
func NewPutTransactionsOK() *PutTransactionsOK {
	return &PutTransactionsOK{}
}

// PutTransactionsOK describes a response with status code 200, with default header values.
//
// Transaction Response Object
type PutTransactionsOK struct {
	Payload *members_models.TransactionResponse
}

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

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

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

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

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

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

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

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

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

func (o *PutTransactionsOK) 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 && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewPutTransactionsUnauthorized creates a PutTransactionsUnauthorized with default headers values
func NewPutTransactionsUnauthorized() *PutTransactionsUnauthorized {
	return &PutTransactionsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutTransactionsForbidden creates a PutTransactionsForbidden with default headers values
func NewPutTransactionsForbidden() *PutTransactionsForbidden {
	return &PutTransactionsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPutTransactionsNotFound creates a PutTransactionsNotFound with default headers values
func NewPutTransactionsNotFound() *PutTransactionsNotFound {
	return &PutTransactionsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutTransactionsUnprocessableEntity creates a PutTransactionsUnprocessableEntity with default headers values
func NewPutTransactionsUnprocessableEntity() *PutTransactionsUnprocessableEntity {
	return &PutTransactionsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutTransactionsInternalServerError creates a PutTransactionsInternalServerError with default headers values
func NewPutTransactionsInternalServerError() *PutTransactionsInternalServerError {
	return &PutTransactionsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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