from django.contrib import admin
from .models import Job, JobApplication

@admin.register(Job)
class JobAdmin(admin.ModelAdmin):
    list_display = ('title', 'department', 'employment_type', 'location', 'deadline', 'is_active')
    list_editable = ('is_active',)
    list_filter = ('department', 'employment_type', 'is_active')
    search_fields = ('title', 'description', 'department')
    prepopulated_fields = {'slug': ('title',)}

@admin.register(JobApplication)
class JobApplicationAdmin(admin.ModelAdmin):
    list_display = ('full_name', 'job', 'email', 'phone', 'status', 'applied_at')
    list_editable = ('status',)
    list_filter = ('status', 'job', 'applied_at')
    search_fields = ('full_name', 'email', 'phone', 'cover_letter')
    readonly_fields = ('applied_at',)
