from django.contrib import admin

from .models import JobPosting, JobSource


@admin.register(JobSource)
class JobSourceAdmin(admin.ModelAdmin):
    list_display = ("name", "family", "status", "url", "last_checked_at", "created_at")
    list_filter = ("family", "status")
    search_fields = ("name", "url", "owner")


@admin.register(JobPosting)
class JobPostingAdmin(admin.ModelAdmin):
    list_display = ("title", "company", "location", "contract_type", "source", "published_at", "is_active")
    list_filter = ("contract_type", "is_active", "source__family", "published_at")
    search_fields = ("title", "company", "location", "description")
    autocomplete_fields = ("source",)
