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

// GetTransactionsReader is a Reader for the GetTransactions structure.
type GetTransactionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetTransactionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetTransactionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetTransactionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetTransactionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetTransactionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetTransactionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetTransactionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /transactions] getTransactions", response, response.Code())
	}
}

// NewGetTransactionsOK creates a GetTransactionsOK with default headers values
func NewGetTransactionsOK() *GetTransactionsOK {
	return &GetTransactionsOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetTransactionsUnauthorized creates a GetTransactionsUnauthorized with default headers values
func NewGetTransactionsUnauthorized() *GetTransactionsUnauthorized {
	return &GetTransactionsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetTransactionsForbidden creates a GetTransactionsForbidden with default headers values
func NewGetTransactionsForbidden() *GetTransactionsForbidden {
	return &GetTransactionsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetTransactionsNotFound creates a GetTransactionsNotFound with default headers values
func NewGetTransactionsNotFound() *GetTransactionsNotFound {
	return &GetTransactionsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetTransactionsUnprocessableEntity creates a GetTransactionsUnprocessableEntity with default headers values
func NewGetTransactionsUnprocessableEntity() *GetTransactionsUnprocessableEntity {
	return &GetTransactionsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetTransactionsInternalServerError creates a GetTransactionsInternalServerError with default headers values
func NewGetTransactionsInternalServerError() *GetTransactionsInternalServerError {
	return &GetTransactionsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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