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

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag/jsonutils"
	"github.com/go-openapi/validate"
)

// PasswordRecoveryRequest Recovery selector accepted uniformly regardless of account state.
//
// swagger:model PasswordRecoveryRequest
type PasswordRecoveryRequest struct {

	// email
	// Required: true
	// Max Length: 320
	// Format: email
	Email *strfmt.Email `json:"email"`
}

// Validate validates this password recovery request
func (m *PasswordRecoveryRequest) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateEmail(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *PasswordRecoveryRequest) validateEmail(formats strfmt.Registry) error {

	if err := validate.Required("email", "body", m.Email); err != nil {
		return err
	}

	if err := validate.MaxLength("email", "body", m.Email.String(), 320); err != nil {
		return err
	}

	if err := validate.FormatOf("email", "body", "email", m.Email.String(), formats); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this password recovery request based on context it is used
func (m *PasswordRecoveryRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *PasswordRecoveryRequest) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return jsonutils.WriteJSON(m)
}

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