from django.db import models
from ckeditor.fields import RichTextField
from datetime import datetime
from django.utils import timezone 
from baseapp.models import employee

# Create your models here.
class instruction(models.Model):
    class Meta:
        verbose_name_plural = 'Help'

    heading            =  models.CharField(max_length=150,help_text='Enter the Head content',verbose_name='Heading', null=True)
    content_HTML       =  RichTextField(verbose_name='Content',help_text='Enter the Body content',null=True)
    uid                = models.CharField(max_length=50,verbose_name='UID',help_text="Unique ID for every model add and table view",null=True, unique=True)
    fk_employee = models.ForeignKey(employee, on_delete=models.DO_NOTHING,null=True)
    date_modified = models.DateTimeField(default=timezone.now)
    date_created = models.DateTimeField(auto_now_add=True, null=True)

    def __str__(self):
        return self.uid


class notification(models.Model):
    class Meta:
        verbose_name_plural = 'Notifications'


    list_type = (('primary','primary'),('secondary','secondary'),('success','success'),('warning','warning'),('info','info'),('danger','danger'),('dark','dark'))

    header = models.CharField(max_length=250,help_text='Enter the Head content',verbose_name='Header', null=True)
    body = RichTextField(max_length=250,help_text='Enter the Body content',verbose_name='Body', null=True)
    type = models.CharField(max_length=55,help_text='Select a Color of the content(Bootstrap colors)',verbose_name='Type',choices=list_type, null=True)


    exp_date = models.DateTimeField(default=timezone.now,verbose_name='Expiry Date',help_text='Notification visible until this time')
    fk_employee = models.ForeignKey(employee, on_delete=models.DO_NOTHING,null=True)
    date_modified = models.DateTimeField(default=timezone.now)
    date_created = models.DateTimeField(auto_now_add=True, null=True)

    def __str__(self):
        return self.header +' - ' +self.type

class static_page(models.Model):
    class Meta:
        verbose_name_plural = 'Static Page'

    heading            =  models.CharField(max_length=150,verbose_name='Heading',help_text='Enter the Head content', null=True)
    content_HTML       =  RichTextField(verbose_name='Content',help_text='Enter the Body content',null=True)
    uid                = models.CharField(max_length=50,verbose_name='UID',help_text="Unique ID for every model add and table view",null=True)
    fk_employee = models.ForeignKey(employee, on_delete=models.DO_NOTHING,null=True)
    date_modified = models.DateTimeField(default=timezone.now)
    date_created = models.DateTimeField(auto_now_add=True, null=True)

    def __str__(self):
        return self.heading