from django import forms
from .models import ContactFormSubmission


class NewsletterSubscribeForm(forms.Form):
    email = forms.EmailField(max_length=254)


class NewsletterUnsubscribeForm(forms.Form):
    email = forms.EmailField(
        max_length=254,
        required=False,
        widget=forms.EmailInput(
            attrs={
                "readonly": "readonly",
                "aria-readonly": "true",
            }
        ),
    )
    token = forms.CharField(max_length=1024, widget=forms.HiddenInput())


class ContactForm(forms.ModelForm):
    class Meta:
        model = ContactFormSubmission
        fields = ["name", "contact", "email", "category", "message", "source_page"]
        widgets = {
            "source_page": forms.HiddenInput(),
        }
