# -*- coding: utf-8 -*-

# -----------------------------------------------------------------------------
# Copyright (c) 2016-2017 Anaconda, Inc.
#
# May be copied and distributed freely only as part of an Anaconda or
# Miniconda installation.
# -----------------------------------------------------------------------------

"""Utils for login dialogs."""

import typing
from qtpy import QtCore
from qtpy import QtGui

EMAIL_RE = QtCore.QRegExp(r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')
EMAIL_RE_VALIDATOR = QtGui.QRegExpValidator(EMAIL_RE)

USER_RE = QtCore.QRegExp(r'^[A-Za-z0-9_\.][A-Za-z0-9_\.\-]+$')
USER_RE_VALIDATOR = QtGui.QRegExpValidator(USER_RE)

FORGOT_LOGIN_URL = 'account/forgot_username'
FORGOT_PASSWORD_URL = 'account/forgot_password'  # nosec


class TextContainer(typing.NamedTuple):  # pylint: disable=missing-class-docstring

    title: typing.Optional[str] = None
    header_frame_logo_path: typing.Optional[str] = None
    info_frame_text: typing.Optional[str] = None
    info_frame_logo_path: typing.Optional[str] = None
    form_forgot_links_msg: typing.Optional[str] = None
    form_primary_text: typing.Optional[str] = None
    form_secondary_text: typing.Optional[str] = None
    form_input_label_text: typing.Optional[str] = None
    form_submit_button_text: typing.Optional[str] = None
    message_box_error_text: typing.Optional[str] = None
