from django import forms
from .models import Farmer, AgriculturalHolding, Constituency

class FarmerForm(forms.ModelForm):
    class Meta:
        model = Farmer
        fields = ['name', 'id_number', 'phone_number', 'constituency']
        widgets = {
            'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Full Name'}),
            'id_number': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'National ID / Passport'}),
            'phone_number': forms.TextInput(attrs={'class': 'form-control', 'placeholder': '+264...'}),
            'constituency': forms.Select(attrs={'class': 'form-select'}),
        }

class HoldingForm(forms.ModelForm):
    class Meta:
        model = AgriculturalHolding
        fields = ['size_hectares', 'primary_activity', 'location_description']
        widgets = {
            'size_hectares': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': '0.00'}),
            'primary_activity': forms.Select(attrs={'class': 'form-select'}),
            'location_description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3, 'placeholder': 'Describe the location...'}),
        }
