from django import forms
from .models import Voter, VotingRecord, Donation, VoterContact, EventParticipation

class VoterForm(forms.ModelForm):
    class Meta:
        model = Voter
        fields = [
            'first_name', 'last_name', 'voter_id', 'address', 'phone', 'email',
            'district', 'precinct', 'registration_date', 'likelihood_to_vote',
            'candidate_support', 'yard_sign_status'
        ]
        widgets = {
            'registration_date': forms.DateInput(attrs={'type': 'date'}),
            'address': forms.Textarea(attrs={'rows': 3}),
        }

class VotingRecordForm(forms.ModelForm):
    class Meta:
        model = VotingRecord
        fields = ['election_date', 'description', 'primary_party']
        widgets = {
            'election_date': forms.DateInput(attrs={'type': 'date'}),
        }

class DonationForm(forms.ModelForm):
    class Meta:
        model = Donation
        fields = ['donation_date', 'amount', 'method']
        widgets = {
            'donation_date': forms.DateInput(attrs={'type': 'date'}),
        }

class VoterContactForm(forms.ModelForm):
    class Meta:
        model = VoterContact
        fields = ['contact_type', 'contact_date', 'description', 'notes']
        widgets = {
            'contact_date': forms.DateTimeInput(attrs={'type': 'datetime-local'}),
            'notes': forms.Textarea(attrs={'rows': 3}),
        }

class EventParticipationForm(forms.ModelForm):
    class Meta:
        model = EventParticipation
        fields = ['event_date', 'event_type', 'description']
        widgets = {
            'event_date': forms.DateInput(attrs={'type': 'date'}),
            'description': forms.Textarea(attrs={'rows': 3}),
        }