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

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

// RequestPasswordRecoveryReader is a Reader for the RequestPasswordRecovery structure.
type RequestPasswordRecoveryReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RequestPasswordRecoveryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 202:
		result := NewRequestPasswordRecoveryAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewRequestPasswordRecoveryUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewRequestPasswordRecoveryInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /credentials/password/recovery-requests] requestPasswordRecovery", response, response.Code())
	}
}

// NewRequestPasswordRecoveryAccepted creates a RequestPasswordRecoveryAccepted with default headers values
func NewRequestPasswordRecoveryAccepted() *RequestPasswordRecoveryAccepted {
	return &RequestPasswordRecoveryAccepted{}
}

// RequestPasswordRecoveryAccepted describes a response with status code 202, with default header values.
//
// Uniform accepted response for every account state.
type RequestPasswordRecoveryAccepted struct {
	Payload *members_models.PasswordRecoveryAccepted
}

// IsSuccess returns true when this request password recovery accepted response has a 2xx status code
func (o *RequestPasswordRecoveryAccepted) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this request password recovery accepted response has a 3xx status code
func (o *RequestPasswordRecoveryAccepted) IsRedirect() bool {
	return false
}

// IsClientError returns true when this request password recovery accepted response has a 4xx status code
func (o *RequestPasswordRecoveryAccepted) IsClientError() bool {
	return false
}

// IsServerError returns true when this request password recovery accepted response has a 5xx status code
func (o *RequestPasswordRecoveryAccepted) IsServerError() bool {
	return false
}

// IsCode returns true when this request password recovery accepted response a status code equal to that given
func (o *RequestPasswordRecoveryAccepted) IsCode(code int) bool {
	return code == 202
}

// Code gets the status code for the request password recovery accepted response
func (o *RequestPasswordRecoveryAccepted) Code() int {
	return 202
}

func (o *RequestPasswordRecoveryAccepted) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /credentials/password/recovery-requests][%d] requestPasswordRecoveryAccepted %s", 202, payload)
}

func (o *RequestPasswordRecoveryAccepted) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /credentials/password/recovery-requests][%d] requestPasswordRecoveryAccepted %s", 202, payload)
}

func (o *RequestPasswordRecoveryAccepted) GetPayload() *members_models.PasswordRecoveryAccepted {
	return o.Payload
}

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

	o.Payload = new(members_models.PasswordRecoveryAccepted)

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

	return nil
}

// NewRequestPasswordRecoveryUnauthorized creates a RequestPasswordRecoveryUnauthorized with default headers values
func NewRequestPasswordRecoveryUnauthorized() *RequestPasswordRecoveryUnauthorized {
	return &RequestPasswordRecoveryUnauthorized{}
}

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

// IsSuccess returns true when this request password recovery unauthorized response has a 2xx status code
func (o *RequestPasswordRecoveryUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this request password recovery unauthorized response has a 3xx status code
func (o *RequestPasswordRecoveryUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this request password recovery unauthorized response has a 4xx status code
func (o *RequestPasswordRecoveryUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this request password recovery unauthorized response has a 5xx status code
func (o *RequestPasswordRecoveryUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this request password recovery unauthorized response a status code equal to that given
func (o *RequestPasswordRecoveryUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the request password recovery unauthorized response
func (o *RequestPasswordRecoveryUnauthorized) Code() int {
	return 401
}

func (o *RequestPasswordRecoveryUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /credentials/password/recovery-requests][%d] requestPasswordRecoveryUnauthorized %s", 401, payload)
}

func (o *RequestPasswordRecoveryUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /credentials/password/recovery-requests][%d] requestPasswordRecoveryUnauthorized %s", 401, payload)
}

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

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

// NewRequestPasswordRecoveryInternalServerError creates a RequestPasswordRecoveryInternalServerError with default headers values
func NewRequestPasswordRecoveryInternalServerError() *RequestPasswordRecoveryInternalServerError {
	return &RequestPasswordRecoveryInternalServerError{}
}

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

// IsSuccess returns true when this request password recovery internal server error response has a 2xx status code
func (o *RequestPasswordRecoveryInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this request password recovery internal server error response has a 3xx status code
func (o *RequestPasswordRecoveryInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this request password recovery internal server error response has a 4xx status code
func (o *RequestPasswordRecoveryInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this request password recovery internal server error response has a 5xx status code
func (o *RequestPasswordRecoveryInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the request password recovery internal server error response
func (o *RequestPasswordRecoveryInternalServerError) Code() int {
	return 500
}

func (o *RequestPasswordRecoveryInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /credentials/password/recovery-requests][%d] requestPasswordRecoveryInternalServerError %s", 500, payload)
}

func (o *RequestPasswordRecoveryInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /credentials/password/recovery-requests][%d] requestPasswordRecoveryInternalServerError %s", 500, payload)
}

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

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