from django.contrib import admin

from .models import WeatherForecast, WeatherParameter


@admin.register(WeatherParameter)
class WeatherParameterAdmin(admin.ModelAdmin):
    list_display = ("code", "name_fa", "unit", "created_at")
    search_fields = ("code", "name_fa")


@admin.register(WeatherForecast)
class WeatherForecastAdmin(admin.ModelAdmin):
    list_display = (
        "location",
        "forecast_date",
        "temperature_min",
        "temperature_max",
        "precipitation",
        "et0",
        "fetched_at",
    )
    list_filter = ("forecast_date",)
    search_fields = ("location__latitude", "location__longitude")
