from django.contrib import admin
from .models import Region, Constituency, Farmer, AgriculturalHolding

@admin.register(Region)
class RegionAdmin(admin.ModelAdmin):
    list_display = ('name', 'code')
    search_fields = ('name',)

@admin.register(Constituency)
class ConstituencyAdmin(admin.ModelAdmin):
    list_display = ('name', 'region')
    list_filter = ('region',)
    search_fields = ('name',)

@admin.register(Farmer)
class FarmerAdmin(admin.ModelAdmin):
    list_display = ('name', 'id_number', 'constituency', 'created_at')
    list_filter = ('constituency__region', 'constituency')
    search_fields = ('name', 'id_number')

@admin.register(AgriculturalHolding)
class HoldingAdmin(admin.ModelAdmin):
    list_display = ('farmer', 'primary_activity', 'size_hectares')
    list_filter = ('primary_activity',)