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

// 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) (interface{}, 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("unknown error", response, response.Code())
	}
}

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

/*PostPaymentMethodsOK handles this case with default header values.

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

	CacheControl string

	Payload *ops_models.PaymentMethodResponse
}

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

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

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

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

/*PostPaymentMethodsUnauthorized handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

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

/*PostPaymentMethodsForbidden handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

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

/*PostPaymentMethodsNotFound handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

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

/*PostPaymentMethodsUnprocessableEntity handles this case with default header values.

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

	Payload *ops_models.Error
}

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

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

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

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

/*PostPaymentMethodsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostPaymentMethodsInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

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

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