# (c) cavaliba.com - data - forms_iam.py

from django import forms
from django.utils.translation import gettext as _


class UserPrefForm(forms.Form):
    email = forms.EmailField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        disabled=True,
        label=_("Primary email address"),
        help_text=_("This email receives notifications if no secondary email is provided"),
    )

    mobile = forms.CharField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        disabled=True,
        label=_("Mobile phone number"),
        help_text=_("This mobile receives SMS notifications if no secondary number is provided"),
    )

    firstname = forms.CharField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        label=_("Firstname"),
    )

    lastname = forms.CharField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        label=_("Lastname"),
    )

    displayname = forms.CharField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        label=_("Display name"),
        help_text=_("Use a Firstname Lastname format or similar"),
    )

    want_notifications = forms.BooleanField(
        required=False,
        label=_("Enable Notifications"),
        help_text=_("Select to be included in notifications"),
    )

    want_24 = forms.BooleanField(
        required=False,
        label=_("Enable 24/7 notifications"),
        help_text=_("Select to receive notifications outside of business hours"),
    )

    want_email = forms.BooleanField(
        required=False,
        label=_("Enable email notifications"),
        help_text=_("Select to receive notifications by email"),
    )

    want_sms = forms.BooleanField(
        required=False,
        label=_("Enable SMS notifications"),
        help_text=_("Select to receive notifications by SMS"),
    )

    secondary_email = forms.EmailField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        label=_("Secondary Email address"),
        help_text=_("If provided, will be used instead of primary address"),
    )

    secondary_mobile = forms.CharField(
        max_length=128,
        required=False,
        widget=forms.TextInput(attrs={"size": 60}),
        label=_("Secondary mobile phone number"),
        help_text=_("If provided, will be used instead of primary mobile"),
    )


class PermissionForm(forms.Form):
    keyname = forms.SlugField(
        max_length=128,
        required=True,
        label=_("Keyname(*)"),
        help_text=_("unique, no special chars"),
        widget=forms.TextInput(attrs={"size": 80}),
    )

    displayname = forms.CharField(
        max_length=128,
        required=False,
        label=_("Display name"),
        widget=forms.TextInput(attrs={"size": 60}),
    )

    description = forms.CharField(
        max_length=250,
        required=False,
        label=_("Description"),
        widget=forms.TextInput(attrs={"size": 80}),
    )
