from django.db import models

VEHICLE_CHOICES = (
    ('OASISSB', 'OASIS Small Business'),
    ('OASIS', 'OASIS Unrestricted')
)

STATUS_CHOICES = (
    ('P', 'In Progress'),
    ('C', 'Completed'), 
    ('F', 'Cancelled') 
)


class Vendor(models.Model):

    name = models.CharField(max_length=128)
    duns = models.CharField(max_length=9, unique=True)
    duns_4 = models.CharField(max_length=13, unique=True)
    cage = models.CharField(max_length=15, null=True)
    sam_address = models.CharField(null=True, max_length=128)
    sam_citystate = models.CharField(null=True, max_length=128)
    cm_name = models.CharField(null=True, max_length=128)
    cm_email = models.CharField(null=True, max_length=128)
    cm_phone = models.CharField(null=True, max_length=128)
    pm_name = models.CharField(null=True, max_length=128)
    pm_email = models.CharField(null=True, max_length=128)
    pm_phone = models.CharField(null=True, max_length=128)
    pools = models.ManyToManyField('Pool', through='PoolPIID')
    setasides = models.ManyToManyField('SetAside', null=True, blank=True)
    sam_status = models.CharField(null=True, max_length=128)
    sam_activation_date = models.DateTimeField(null=True)
    sam_expiration_date = models.DateTimeField(null=True)
    sam_exclusion = models.NullBooleanField(null=True)
    sam_url = models.URLField(null=True)
    annual_revenue = models.BigIntegerField(null=True)
    number_of_employees = models.IntegerField(null=True)


    def __str__(self):
        return self.name


class Pool(models.Model):
    id = models.CharField(primary_key=True, max_length=128)
    name = models.CharField(max_length=128, default='Pool')
    number = models.CharField(max_length=128)
    vehicle = models.CharField(choices=VEHICLE_CHOICES, max_length=7)
    naics = models.ManyToManyField('Naics')
    threshold = models.CharField(null=True, max_length=128)

    def __str__(self):
        return "Pool {0} - {1}".format(self.number, self.get_vehicle_display())


class PoolPIID(models.Model):
    vendor = models.ForeignKey('Vendor')
    pool = models.ForeignKey('Pool')
    piid = models.CharField(max_length=128)

    def __str__(self):
        return "{0} - {1} - {2}".format(self.vendor.name, self.pool.id, self.piid)


class SetAside(models.Model):
    code = models.CharField(unique=True, max_length=128)
    short_name = models.CharField(max_length=128)
    abbreviation = models.CharField(max_length=10, null=True)
    far_order = models.IntegerField(null=True)

    def  __str__(self):
        return self.short_name


class Naics(models.Model):
    code = models.CharField(max_length=128)
    description = models.TextField()
    short_code = models.CharField(unique=True, max_length=25)

    def __str__(self):
        return "{0} - {1}".format(self.code, self.description)

class SamLoad(models.Model):
    sam_load = models.DateField()

[((268, 300), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (284, 300), False, 'from django.db import models\n'), ((312, 355), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(9)', 'unique': '(True)'}), '(max_length=9, unique=True)\n', (328, 355), False, 'from django.db import models\n'), ((369, 413), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(13)', 'unique': '(True)'}), '(max_length=13, unique=True)\n', (385, 413), False, 'from django.db import models\n'), ((425, 467), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(15)', 'null': '(True)'}), '(max_length=15, null=True)\n', (441, 467), False, 'from django.db import models\n'), ((486, 529), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (502, 529), False, 'from django.db import models\n'), ((550, 593), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (566, 593), False, 'from django.db import models\n'), ((608, 651), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (624, 651), False, 'from django.db import models\n'), ((667, 710), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (683, 710), False, 'from django.db import models\n'), ((726, 769), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (742, 769), False, 'from django.db import models\n'), ((784, 827), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (800, 827), False, 'from django.db import models\n'), ((843, 886), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (859, 886), False, 'from django.db import models\n'), ((902, 945), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (918, 945), False, 'from django.db import models\n'), ((958, 1008), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""Pool"""'], {'through': '"""PoolPIID"""'}), "('Pool', through='PoolPIID')\n", (980, 1008), False, 'from django.db import models\n'), ((1025, 1082), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""SetAside"""'], {'null': '(True)', 'blank': '(True)'}), "('SetAside', null=True, blank=True)\n", (1047, 1082), False, 'from django.db import models\n'), ((1100, 1143), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (1116, 1143), False, 'from django.db import models\n'), ((1170, 1201), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'null': '(True)'}), '(null=True)\n', (1190, 1201), False, 'from django.db import models\n'), ((1228, 1259), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'null': '(True)'}), '(null=True)\n', (1248, 1259), False, 'from django.db import models\n'), ((1280, 1314), 'django.db.models.NullBooleanField', 'models.NullBooleanField', ([], {'null': '(True)'}), '(null=True)\n', (1303, 1314), False, 'from django.db import models\n'), ((1329, 1355), 'django.db.models.URLField', 'models.URLField', ([], {'null': '(True)'}), '(null=True)\n', (1344, 1355), False, 'from django.db import models\n'), ((1377, 1410), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'null': '(True)'}), '(null=True)\n', (1399, 1410), False, 'from django.db import models\n'), ((1437, 1467), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (1456, 1467), False, 'from django.db import models\n'), ((1555, 1605), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'max_length': '(128)'}), '(primary_key=True, max_length=128)\n', (1571, 1605), False, 'from django.db import models\n'), ((1617, 1665), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)', 'default': '"""Pool"""'}), "(max_length=128, default='Pool')\n", (1633, 1665), False, 'from django.db import models\n'), ((1679, 1711), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (1695, 1711), False, 'from django.db import models\n'), ((1726, 1781), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'VEHICLE_CHOICES', 'max_length': '(7)'}), '(choices=VEHICLE_CHOICES, max_length=7)\n', (1742, 1781), False, 'from django.db import models\n'), ((1794, 1825), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""Naics"""'], {}), "('Naics')\n", (1816, 1825), False, 'from django.db import models\n'), ((1842, 1885), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(128)'}), '(null=True, max_length=128)\n', (1858, 1885), False, 'from django.db import models\n'), ((2035, 2062), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Vendor"""'], {}), "('Vendor')\n", (2052, 2062), False, 'from django.db import models\n'), ((2074, 2099), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Pool"""'], {}), "('Pool')\n", (2091, 2099), False, 'from django.db import models\n'), ((2111, 2143), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (2127, 2143), False, 'from django.db import models\n'), ((2294, 2339), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(128)'}), '(unique=True, max_length=128)\n', (2310, 2339), False, 'from django.db import models\n'), ((2357, 2389), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (2373, 2389), False, 'from django.db import models\n'), ((2409, 2451), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', 'null': '(True)'}), '(max_length=10, null=True)\n', (2425, 2451), False, 'from django.db import models\n'), ((2468, 2498), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (2487, 2498), False, 'from django.db import models\n'), ((2595, 2627), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (2611, 2627), False, 'from django.db import models\n'), ((2646, 2664), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (2662, 2664), False, 'from django.db import models\n'), ((2682, 2726), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(25)'}), '(unique=True, max_length=25)\n', (2698, 2726), False, 'from django.db import models\n'), ((2859, 2877), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2875, 2877), False, 'from django.db import models\n')]