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

package account

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"

	"github.com/openziti/zrok/rest_model_zrok"
)

// 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) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewChangePasswordOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewChangePasswordBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	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 /changePassword] changePassword", response, response.Code())
	}
}

// NewChangePasswordOK creates a ChangePasswordOK with default headers values
func NewChangePasswordOK() *ChangePasswordOK {
	return &ChangePasswordOK{}
}

/*
ChangePasswordOK describes a response with status code 200, with default header values.

changed password
*/
type ChangePasswordOK struct {
}

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

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

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

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

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

// Code gets the status code for the change password o k response
func (o *ChangePasswordOK) Code() int {
	return 200
}

func (o *ChangePasswordOK) Error() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordOK ", 200)
}

func (o *ChangePasswordOK) String() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordOK ", 200)
}

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

	return nil
}

// NewChangePasswordBadRequest creates a ChangePasswordBadRequest with default headers values
func NewChangePasswordBadRequest() *ChangePasswordBadRequest {
	return &ChangePasswordBadRequest{}
}

/*
ChangePasswordBadRequest describes a response with status code 400, with default header values.

password not changed
*/
type ChangePasswordBadRequest struct {
}

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

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

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

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

// IsCode returns true when this change password bad request response a status code equal to that given
func (o *ChangePasswordBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the change password bad request response
func (o *ChangePasswordBadRequest) Code() int {
	return 400
}

func (o *ChangePasswordBadRequest) Error() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordBadRequest ", 400)
}

func (o *ChangePasswordBadRequest) String() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordBadRequest ", 400)
}

func (o *ChangePasswordBadRequest) 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.

unauthorized
*/
type ChangePasswordUnauthorized struct {
}

// 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 {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordUnauthorized ", 401)
}

func (o *ChangePasswordUnauthorized) String() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordUnauthorized ", 401)
}

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

	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.

password validation failure
*/
type ChangePasswordUnprocessableEntity struct {
	Payload rest_model_zrok.ErrorMessage
}

// 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 {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *ChangePasswordUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *ChangePasswordUnprocessableEntity) GetPayload() rest_model_zrok.ErrorMessage {
	return o.Payload
}

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

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && 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.

internal server error
*/
type ChangePasswordInternalServerError struct {
}

// 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 {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordInternalServerError ", 500)
}

func (o *ChangePasswordInternalServerError) String() string {
	return fmt.Sprintf("[POST /changePassword][%d] changePasswordInternalServerError ", 500)
}

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

	return nil
}

/*
ChangePasswordBody change password body
swagger:model ChangePasswordBody
*/
type ChangePasswordBody struct {

	// email
	Email string `json:"email,omitempty"`

	// new password
	NewPassword string `json:"newPassword,omitempty"`

	// old password
	OldPassword string `json:"oldPassword,omitempty"`
}

// Validate validates this change password body
func (o *ChangePasswordBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this change password body based on context it is used
func (o *ChangePasswordBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *ChangePasswordBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *ChangePasswordBody) UnmarshalBinary(b []byte) error {
	var res ChangePasswordBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
