// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package payment_method

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

	"github.com/taxnexus/go/lib/api/ops/ops_models"
)

// GetPaymentMethodsReader is a Reader for the GetPaymentMethods structure.
type GetPaymentMethodsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetPaymentMethodsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetPaymentMethodsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetPaymentMethodsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetPaymentMethodsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetPaymentMethodsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetPaymentMethodsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewGetPaymentMethodsOK creates a GetPaymentMethodsOK with default headers values
func NewGetPaymentMethodsOK() *GetPaymentMethodsOK {
	return &GetPaymentMethodsOK{}
}

/*GetPaymentMethodsOK handles this case with default header values.

Taxnexus Response with an array of Payment Method objects
*/
type GetPaymentMethodsOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *ops_models.PaymentMethodResponse
}

func (o *GetPaymentMethodsOK) Error() string {
	return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsOK  %+v", 200, o.Payload)
}

func (o *GetPaymentMethodsOK) GetPayload() *ops_models.PaymentMethodResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(ops_models.PaymentMethodResponse)

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

	return nil
}

// NewGetPaymentMethodsUnauthorized creates a GetPaymentMethodsUnauthorized with default headers values
func NewGetPaymentMethodsUnauthorized() *GetPaymentMethodsUnauthorized {
	return &GetPaymentMethodsUnauthorized{}
}

/*GetPaymentMethodsUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type GetPaymentMethodsUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *GetPaymentMethodsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsUnauthorized  %+v", 401, o.Payload)
}

func (o *GetPaymentMethodsUnauthorized) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewGetPaymentMethodsForbidden creates a GetPaymentMethodsForbidden with default headers values
func NewGetPaymentMethodsForbidden() *GetPaymentMethodsForbidden {
	return &GetPaymentMethodsForbidden{}
}

/*GetPaymentMethodsForbidden handles this case with default header values.

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

	Payload *ops_models.Error
}

func (o *GetPaymentMethodsForbidden) Error() string {
	return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsForbidden  %+v", 403, o.Payload)
}

func (o *GetPaymentMethodsForbidden) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewGetPaymentMethodsNotFound creates a GetPaymentMethodsNotFound with default headers values
func NewGetPaymentMethodsNotFound() *GetPaymentMethodsNotFound {
	return &GetPaymentMethodsNotFound{}
}

/*GetPaymentMethodsNotFound handles this case with default header values.

Resource was not found
*/
type GetPaymentMethodsNotFound struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *GetPaymentMethodsNotFound) Error() string {
	return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsNotFound  %+v", 404, o.Payload)
}

func (o *GetPaymentMethodsNotFound) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewGetPaymentMethodsUnprocessableEntity creates a GetPaymentMethodsUnprocessableEntity with default headers values
func NewGetPaymentMethodsUnprocessableEntity() *GetPaymentMethodsUnprocessableEntity {
	return &GetPaymentMethodsUnprocessableEntity{}
}

/*GetPaymentMethodsUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type GetPaymentMethodsUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *GetPaymentMethodsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *GetPaymentMethodsUnprocessableEntity) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewGetPaymentMethodsInternalServerError creates a GetPaymentMethodsInternalServerError with default headers values
func NewGetPaymentMethodsInternalServerError() *GetPaymentMethodsInternalServerError {
	return &GetPaymentMethodsInternalServerError{}
}

/*GetPaymentMethodsInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetPaymentMethodsInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

func (o *GetPaymentMethodsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsInternalServerError  %+v", 500, o.Payload)
}

func (o *GetPaymentMethodsInternalServerError) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}
