from django.contrib import admin
from .models import Insurance, PhoneLink, EmailLink, WebLink, AddressLink


# Register your models here.
class PhoneLinkInline(admin.TabularInline):
    model = PhoneLink
    extra = 1


class EmailLinkInline(admin.TabularInline):
    model = EmailLink
    extra = 1


class WebLinkLinkInline(admin.TabularInline):
    model = WebLink
    extra = 1


class AddressLinkInline(admin.TabularInline):
    model = AddressLink
    extra = 1


@admin.register(Insurance)
class InsuranceAdmin(admin.ModelAdmin):
    list_display = ('company_name', 'extra_line',)
    list_filter = ('company_name',)
    search_fields = ('company_name',)
    fieldsets = (
        (None, {
            'fields': ('company_name', 'extra_line',)
        }),
    )

    inlines = [
        AddressLinkInline,
        PhoneLinkInline,
        EmailLinkInline,
        WebLinkLinkInline,
    ]
