from django.db import models
from django.core.files.storage import FileSystemStorage
from django.contrib.auth.models import User

# Create your models here.


class Faq(models.Model):
    question = models.CharField(max_length=516)
    post = models.TextField()
    seq_num = models.SmallIntegerField()
    published = models.BooleanField(default=False)

    class Meta:
        verbose_name_plural = "FAQs"
        ordering = ['seq_num',]

    def __unicode__(self):
        return "%s" % self.question

    def __str__(self):
        return u'%s' % self.question


class SocialPost(models.Model):
    title = models.CharField(max_length=64)
    post = models.TextField()
    uri = models.URLField()
    created_at = models.DateField(auto_now=True)
    author = models.CharField(max_length=64, blank=True, null=True)
    published = models.BooleanField(default=False)

    class Meta:
        verbose_name_plural = "Social Posts"
        ordering = ['created_at', 'title']

    def __unicode__(self):
        return "%s" % self.title

    def __str__(self):
        return u'%s' % self.title


class SocialLink(models.Model):
    uri = models.CharField(max_length=63, blank=True, null=True)
    text = models.CharField(max_length=515, blank=True, null=True)
    link = models.URLField(blank=True, null=True)
    handle = models.CharField(max_length=63, blank=True, null=True)
    likes = models.IntegerField(blank=True, null=True)
    reposts = models.IntegerField(blank=True, null=True)
    quotes = models.IntegerField(blank=True, null=True)
    replies = models.IntegerField(blank=True, null=True)
    created_at = models.DateTimeField()
    platform = models.CharField(max_length=16)

    rt_uri = models.CharField(max_length=63, blank=True, null=True)
    rt_text = models.CharField(max_length=515, blank=True, null=True)
    rt_link = models.URLField(blank=True, null=True)
    rt_handle = models.CharField(max_length=63, blank=True, null=True)

    published = models.BooleanField(default=0)
    pub_link = models.URLField(blank=True, null=True)
    star = models.BooleanField(default=0)

    class Meta:
        unique_together = ("uri",)
        verbose_name_plural = "Social Links"
        # ordering = ['-likes', ]
        ordering = ['-created_at', ]
        

    def __unicode__(self):
        return "%s-" % self.handle

    def __str__(self):
        return u'%s' % self.handle
    

class SocialImg(models.Model):
    uri = models.CharField(max_length=63, blank=True, null=True)
    text = models.CharField(max_length=515, blank=True, null=True)
    img_link = models.URLField(blank=True, null=True)
    handle = models.CharField(max_length=63, blank=True, null=True)
    created_at = models.DateTimeField()
    platform = models.CharField(max_length=16)

    class Meta:
        unique_together = ("uri",)
        verbose_name_plural = "Social Images"
        # ordering = ['-likes', ]
        ordering = ['-created_at', ]
        

    def __unicode__(self):
        return "%s-" % self.handle

    def __str__(self):
        return u'%s' % self.handle