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

// ChangePasswordReader is a Reader for the ChangePassword structure.
type ChangePasswordReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ChangePasswordReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 204:
		result := NewChangePasswordNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewChangePasswordUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewChangePasswordUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewChangePasswordInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /credentials/password/change] changePassword", response, response.Code())
	}
}

// NewChangePasswordNoContent creates a ChangePasswordNoContent with default headers values
func NewChangePasswordNoContent() *ChangePasswordNoContent {
	return &ChangePasswordNoContent{}
}

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

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

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

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

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

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

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

func (o *ChangePasswordNoContent) Error() string {
	return fmt.Sprintf("[POST /credentials/password/change][%d] changePasswordNoContent", 204)
}

func (o *ChangePasswordNoContent) String() string {
	return fmt.Sprintf("[POST /credentials/password/change][%d] changePasswordNoContent", 204)
}

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

	return nil
}

// NewChangePasswordUnauthorized creates a ChangePasswordUnauthorized with default headers values
func NewChangePasswordUnauthorized() *ChangePasswordUnauthorized {
	return &ChangePasswordUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewChangePasswordUnprocessableEntity creates a ChangePasswordUnprocessableEntity with default headers values
func NewChangePasswordUnprocessableEntity() *ChangePasswordUnprocessableEntity {
	return &ChangePasswordUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewChangePasswordInternalServerError creates a ChangePasswordInternalServerError with default headers values
func NewChangePasswordInternalServerError() *ChangePasswordInternalServerError {
	return &ChangePasswordInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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