"""
Admin registration for Automation models
"""
from django.contrib import admin
from igny8_core.admin.base import AccountAdminMixin
from .models import AutomationConfig, AutomationRun


@admin.register(AutomationConfig)
class AutomationConfigAdmin(AccountAdminMixin, admin.ModelAdmin):
    list_display = ('site', 'is_enabled', 'frequency', 'scheduled_time', 'within_stage_delay', 'between_stage_delay', 'last_run_at')
    list_filter = ('is_enabled', 'frequency')
    search_fields = ('site__domain',)


@admin.register(AutomationRun)
class AutomationRunAdmin(AccountAdminMixin, admin.ModelAdmin):
    list_display = ('run_id', 'site', 'status', 'current_stage', 'started_at', 'completed_at')
    list_filter = ('status', 'current_stage')
    search_fields = ('run_id', 'site__domain')
