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

// PostPaymentMethodsReader is a Reader for the PostPaymentMethods structure.
type PostPaymentMethodsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostPaymentMethodsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostPaymentMethodsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostPaymentMethodsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostPaymentMethodsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostPaymentMethodsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostPaymentMethodsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /paymentmethods] postPaymentMethods", response, response.Code())
	}
}

// NewPostPaymentMethodsOK creates a PostPaymentMethodsOK with default headers values
func NewPostPaymentMethodsOK() *PostPaymentMethodsOK {
	return &PostPaymentMethodsOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPaymentMethodsUnauthorized creates a PostPaymentMethodsUnauthorized with default headers values
func NewPostPaymentMethodsUnauthorized() *PostPaymentMethodsUnauthorized {
	return &PostPaymentMethodsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPaymentMethodsForbidden creates a PostPaymentMethodsForbidden with default headers values
func NewPostPaymentMethodsForbidden() *PostPaymentMethodsForbidden {
	return &PostPaymentMethodsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostPaymentMethodsNotFound creates a PostPaymentMethodsNotFound with default headers values
func NewPostPaymentMethodsNotFound() *PostPaymentMethodsNotFound {
	return &PostPaymentMethodsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPaymentMethodsUnprocessableEntity creates a PostPaymentMethodsUnprocessableEntity with default headers values
func NewPostPaymentMethodsUnprocessableEntity() *PostPaymentMethodsUnprocessableEntity {
	return &PostPaymentMethodsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPaymentMethodsInternalServerError creates a PostPaymentMethodsInternalServerError with default headers values
func NewPostPaymentMethodsInternalServerError() *PostPaymentMethodsInternalServerError {
	return &PostPaymentMethodsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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