# -*- encoding: utf-8 -*-

from django.contrib import admin

from .models import (
    Server,
    ContentFilter,
    MessageMutator,
    MessageStyle,
    DiscordChannel,
    Subscription,
    Content
)


@admin.register(Server)
class ServerAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "name",
        "icon_hash",
        "is_bot_operational",
        "active"
    ]
    list_display_links = ["id"]


@admin.register(ContentFilter)
class ContentFilterAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "name",
        "server",
        "match",
        "matching_algorithm",
        "is_insensitive",
        "is_whitelist"
    ]
    list_display_links = ["name"]


@admin.register(MessageMutator)
class MessageMutatorAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "name",
        "value"
    ]
    list_display_links = ["name"]


@admin.register(MessageStyle)
class MessageStyleAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "name",
        "server",
        "is_embed",
        "colour",
        "is_hyperlinked",
        "show_author",
        "show_timestamp",
        "show_images",
        "fetch_images",
        "title_mutator",
        "description_mutator",
        "auto_created"
    ]
    list_display_links = ["name"]


@admin.register(DiscordChannel)
class DiscordChannelAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "name",
        "server",
        "is_nsfw"
    ]
    list_display_links = ["name"]


@admin.register(Subscription)
class Subscription(admin.ModelAdmin):
    list_display = [
        "id",
        "name",
        "server",
        "url",
        "created_at",
        "updated_at",
        "extra_notes",
        "active",
        "message_style"
    ]
    list_display_links = ["name"]


@admin.register(Content)
class ContentAdmin(admin.ModelAdmin):
    list_display = [
        "id",
        "subscription",
        "item_id",
        "item_guid",
        "item_url",
        "item_title",
        "item_content_hash"
    ]
