from django.contrib import admin
from .models import Multiplexor, Channel, SensorType, SignalFormat, Sensor, Metric, Alert

@admin.register(Multiplexor)
class MultiplexorAdmin(admin.ModelAdmin):
    list_display = ('name', 'ip', 'subnet', 'gateway', 'sd_path')

@admin.register(Channel)
class ChannelAdmin(admin.ModelAdmin):
    list_display = ('multiplexor', 'number', 'position')

@admin.register(SensorType) 
class SensorTypeAdmin(admin.ModelAdmin):
    list_display = ('code', 'name', 'description')


@admin.register(Metric)
class MetricAdmin(admin.ModelAdmin):
    list_display = ('timestamp', 'sensor', 'raw_value', 'value', 'status')

@admin.register(Alert)
class AlertAdmin(admin.ModelAdmin):
    list_display = ('sensor', 'metric', 'sensor_type', 'message', 'severity', 'created_at', 'resolved')

@admin.register(SignalFormat)
class SignalFormatAdmin(admin.ModelAdmin):
    list_display = ('sensor_type', 'code', 'unit', 'conversion_rule')

@admin.register(Sensor)
class SensorAdmin(admin.ModelAdmin):
    list_display = ('channel', 'sensor_type', 'signal_format', 'serial_number', 'name', 'math_formula')