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

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

// PutPaymentMethodsReader is a Reader for the PutPaymentMethods structure.
type PutPaymentMethodsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutPaymentMethodsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutPaymentMethodsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutPaymentMethodsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutPaymentMethodsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutPaymentMethodsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutPaymentMethodsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /paymentmethods] putPaymentMethods", response, response.Code())
	}
}

// NewPutPaymentMethodsOK creates a PutPaymentMethodsOK with default headers values
func NewPutPaymentMethodsOK() *PutPaymentMethodsOK {
	return &PutPaymentMethodsOK{}
}

// PutPaymentMethodsOK describes a response with status code 200, with default header values.
//
// PaymentMethod Response Object
type PutPaymentMethodsOK struct {
	Payload *members_models.PaymentMethodResponse
}

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

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

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

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

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

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

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

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

func (o *PutPaymentMethodsOK) GetPayload() *members_models.PaymentMethodResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.PaymentMethodResponse)

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

	return nil
}

// NewPutPaymentMethodsUnauthorized creates a PutPaymentMethodsUnauthorized with default headers values
func NewPutPaymentMethodsUnauthorized() *PutPaymentMethodsUnauthorized {
	return &PutPaymentMethodsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutPaymentMethodsForbidden creates a PutPaymentMethodsForbidden with default headers values
func NewPutPaymentMethodsForbidden() *PutPaymentMethodsForbidden {
	return &PutPaymentMethodsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPutPaymentMethodsNotFound creates a PutPaymentMethodsNotFound with default headers values
func NewPutPaymentMethodsNotFound() *PutPaymentMethodsNotFound {
	return &PutPaymentMethodsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutPaymentMethodsUnprocessableEntity creates a PutPaymentMethodsUnprocessableEntity with default headers values
func NewPutPaymentMethodsUnprocessableEntity() *PutPaymentMethodsUnprocessableEntity {
	return &PutPaymentMethodsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutPaymentMethodsInternalServerError creates a PutPaymentMethodsInternalServerError with default headers values
func NewPutPaymentMethodsInternalServerError() *PutPaymentMethodsInternalServerError {
	return &PutPaymentMethodsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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