from django.db import models
from django.contrib import admin


class BaseModel(models.Model):
    created_at = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated_at = models.DateTimeField(blank=True, null=True, auto_now=True)
    active = models.BooleanField(default=True)

    class Meta:
        abstract = True


class MailingList(BaseModel):
    email = models.EmailField(max_length=254, blank=False, null=False)


class SiteSection(BaseModel):
    section = models.CharField(max_length=254, blank=False, null=False)
    content = models.TextField()


class SiteSectionAdmin(admin.ModelAdmin):
    search_fields = (
    )

    list_display = (
        'section',
    )


class LinkTree(BaseModel):
    name = models.CharField(max_length=254, blank=False, null=False)
    url = models.TextField()
    order = models.IntegerField()
    color = models.CharField(max_length=254, choices=[("btn-light", "WHITE"), ("btn-success", "GREEN"), ("btn-danger", "RED")], default="WHITE")


class LinkTreeAdmin(admin.ModelAdmin):
    search_fields=(
    )

    list_display=(
        'name',
        'url',
        'order',
        'color'
    )


class Show(BaseModel):
    name=models.CharField(max_length=254, blank=False, null=False)
    description=models.TextField()
    location=models.CharField(max_length=254, blank=False, null=False)
    date=models.DateTimeField(blank=True, null=True, auto_now_add=True)


class ShowAdmin(admin.ModelAdmin):
    search_fields=(
    )

    list_display=(
        'name',
        'description',
        'location',
        'date',
        'active'
    )
