from django.db import models

# Create your models here.


class Bill(models.Model):
    name = models.CharField(max_length=64, verbose_name='Name')
    type = models.CharField(max_length=64, verbose_name="Type")
    due = models.DateField(verbose_name="Due Date")
    amount = models.FloatField(default='00.00')
    is_paid = models.BooleanField(default=False, verbose_name="Paid")
    paid_date = models.DateField('Paid Date', null=True, blank=True)
    is_overdue = models.BooleanField(default=False, verbose_name="Overdue")
    is_missed = models.BooleanField(
        default=False, verbose_name='Missed Payment')
    organization = models.ForeignKey(
        'Organization', on_delete=models.CASCADE, verbose_name='Organization', null=True, blank=True)

    def overdue(self):
        return self.is_overdue

    def __str__(self):
        return ("%s - %s" % (self.name, self.due))

# Create organization model


class Organization(models.Model):
    name = models.CharField(max_length=64, verbose_name='Name')
    address = models.CharField(max_length=64, verbose_name='Address')
    phone = models.CharField(max_length=64, verbose_name='Phone')
    email = models.CharField(max_length=64, verbose_name='Email')
    website = models.CharField(max_length=64, verbose_name='Website')

    def __str__(self):
        return ("%s - %s" % (self.name, self.phone))
