from django import forms

from .models import EmailTemplate

# class SmallTextArea(forms.Textarea):
#     def __init__(self, *args, **kwargs):
#         kwargs.setdefault('attrs', {})
#         kwargs['attrs'].update({
#             'rows': 2,
#             'cols': 100,
#             'style': 'height: 80px; width: 800px;'
#         })
#         super().__init__(*args, **kwargs)

# class ProspectForm(forms.ModelForm):
#     class Meta:
#         model = Prospect
#         fields = ['entity_name', 'first_name', 'last_name', 'email',
#                  'phone', 'address', 'zip_code', 'city']

# class BulkEmailForm(forms.Form):
#     prospects = forms.ModelMultipleChoiceField(
#         queryset=Prospect.objects.all(),
#         widget=forms.CheckboxSelectMultiple
#     )
#     subject = forms.CharField(max_length=200)
#     content = forms.CharField(widget=forms.Textarea)

# class EventForm(forms.ModelForm):
#     prospects = forms.ModelMultipleChoiceField(
#         queryset=Prospect.objects.all(),
#         widget=forms.SelectMultiple(attrs={'class': 'select2'}),
#         required=False
#     )
#     description = forms.CharField(widget=SmallTextArea)
#     attachment_text = forms.CharField(widget=SmallTextArea)

#     class Meta:
#         model = Event
#         fields = ['date', 'type', 'description', 'attachment_text', 'prospects', 'status']
#         widgets = {
#             'date': forms.DateTimeInput(attrs={'type': 'datetime-local'}),
#         }

class FileImportForm(forms.Form):
    source = forms.CharField(max_length=200)
    file = forms.FileField(
        label='Select file to import',
        help_text='Choose a file to upload and process',
        widget=forms.FileInput(attrs={'accept': '.csv,.xlsx,.xls,.txt'})
    )

class CSVImportForm(forms.Form):
    csv_file = forms.FileField()

class EmailTemplateSelectionForm(forms.Form):
    email_template = forms.ModelChoiceField(
        queryset=EmailTemplate.objects.all(),
        empty_label="Select an email template...",
        widget=forms.Select(attrs={'class': 'form-control'})
    )
