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

// CompletePasswordRecoveryReader is a Reader for the CompletePasswordRecovery structure.
type CompletePasswordRecoveryReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CompletePasswordRecoveryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 204:
		result := NewCompletePasswordRecoveryNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewCompletePasswordRecoveryUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewCompletePasswordRecoveryUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCompletePasswordRecoveryInternalServerError()
		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-completions] completePasswordRecovery", response, response.Code())
	}
}

// NewCompletePasswordRecoveryNoContent creates a CompletePasswordRecoveryNoContent with default headers values
func NewCompletePasswordRecoveryNoContent() *CompletePasswordRecoveryNoContent {
	return &CompletePasswordRecoveryNoContent{}
}

// CompletePasswordRecoveryNoContent describes a response with status code 204, with default header values.
//
// Password reset; all sessions revoked and fresh login required.
type CompletePasswordRecoveryNoContent struct {
}

// IsSuccess returns true when this complete password recovery no content response has a 2xx status code
func (o *CompletePasswordRecoveryNoContent) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this complete password recovery no content response has a 3xx status code
func (o *CompletePasswordRecoveryNoContent) IsRedirect() bool {
	return false
}

// IsClientError returns true when this complete password recovery no content response has a 4xx status code
func (o *CompletePasswordRecoveryNoContent) IsClientError() bool {
	return false
}

// IsServerError returns true when this complete password recovery no content response has a 5xx status code
func (o *CompletePasswordRecoveryNoContent) IsServerError() bool {
	return false
}

// IsCode returns true when this complete password recovery no content response a status code equal to that given
func (o *CompletePasswordRecoveryNoContent) IsCode(code int) bool {
	return code == 204
}

// Code gets the status code for the complete password recovery no content response
func (o *CompletePasswordRecoveryNoContent) Code() int {
	return 204
}

func (o *CompletePasswordRecoveryNoContent) Error() string {
	return fmt.Sprintf("[POST /credentials/password/recovery-completions][%d] completePasswordRecoveryNoContent", 204)
}

func (o *CompletePasswordRecoveryNoContent) String() string {
	return fmt.Sprintf("[POST /credentials/password/recovery-completions][%d] completePasswordRecoveryNoContent", 204)
}

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

	return nil
}

// NewCompletePasswordRecoveryUnauthorized creates a CompletePasswordRecoveryUnauthorized with default headers values
func NewCompletePasswordRecoveryUnauthorized() *CompletePasswordRecoveryUnauthorized {
	return &CompletePasswordRecoveryUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewCompletePasswordRecoveryUnprocessableEntity creates a CompletePasswordRecoveryUnprocessableEntity with default headers values
func NewCompletePasswordRecoveryUnprocessableEntity() *CompletePasswordRecoveryUnprocessableEntity {
	return &CompletePasswordRecoveryUnprocessableEntity{}
}

// CompletePasswordRecoveryUnprocessableEntity describes a response with status code 422, with default header values.
//
// Invalid, expired, revoked, or consumed token, or invalid password.
type CompletePasswordRecoveryUnprocessableEntity struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this complete password recovery unprocessable entity response has a 2xx status code
func (o *CompletePasswordRecoveryUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this complete password recovery unprocessable entity response has a 3xx status code
func (o *CompletePasswordRecoveryUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this complete password recovery unprocessable entity response has a 4xx status code
func (o *CompletePasswordRecoveryUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this complete password recovery unprocessable entity response has a 5xx status code
func (o *CompletePasswordRecoveryUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this complete password recovery unprocessable entity response a status code equal to that given
func (o *CompletePasswordRecoveryUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the complete password recovery unprocessable entity response
func (o *CompletePasswordRecoveryUnprocessableEntity) Code() int {
	return 422
}

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

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

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

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

// NewCompletePasswordRecoveryInternalServerError creates a CompletePasswordRecoveryInternalServerError with default headers values
func NewCompletePasswordRecoveryInternalServerError() *CompletePasswordRecoveryInternalServerError {
	return &CompletePasswordRecoveryInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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