from django.contrib import admin

from .models import AITask, ModelConfig, ModelProvider


@admin.register(ModelProvider)
class ModelProviderAdmin(admin.ModelAdmin):
    list_display = ("name", "display_name", "status", "updated_at")
    search_fields = ("name", "display_name")
    list_filter = ("status",)


@admin.register(ModelConfig)
class ModelConfigAdmin(admin.ModelAdmin):
    list_display = ("provider", "name", "capability", "unit_price", "status", "rate_limit_per_minute")
    search_fields = ("provider__name", "name", "display_name")
    list_filter = ("capability", "status")


@admin.register(AITask)
class AITaskAdmin(admin.ModelAdmin):
    list_display = ("id", "team", "project", "task_type", "status", "model_config", "actual_cost", "updated_at")
    search_fields = ("idempotency_key", "provider_task_id", "project__name", "team__name")
    list_filter = ("task_type", "status", "model_config__capability")
    readonly_fields = ("request_payload", "response_payload")

