from django.contrib import admin

from tickets.models import Attachment, Comment, TicketList, Ticket


class TicketAdmin(admin.ModelAdmin):
    list_display = ("title", "ticket_list", "ticket_type",  "status", "priority", "created_at", "due_date")
    list_filter = ("ticket_list", "ticket_type",)
    ordering = ("priority",)
    search_fields = ("title", "note")


class CommentAdmin(admin.ModelAdmin):
    list_display = ("author", "date", "snippet")


class AttachmentAdmin(admin.ModelAdmin):
    list_display = ("ticket", "added_by", "timestamp", "file")
    autocomplete_fields = ["added_by", "ticket"]


admin.site.register(TicketList)
admin.site.register(Comment, CommentAdmin)
admin.site.register(Ticket, TicketAdmin)
admin.site.register(Attachment, AttachmentAdmin)
