# Generated by Django 2.1.3 on 2018-11-14 23:02

import common.model_mixins
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(help_text='The date and time of creation.', verbose_name='Date Created')),
                ('updated', models.DateTimeField(help_text='The date and time last updated.', verbose_name='Last Updated')),
                ('public_id', models.CharField(blank=True, help_text='Public ID to identify a individual category.', max_length=30, unique=True, verbose_name='Public Category ID')),
                ('name', models.CharField(help_text='The name of this category.', max_length=250, verbose_name='Name')),
                ('path', models.CharField(editable=False, help_text='The full hierarchical path of this category.', max_length=1000, verbose_name='Full Path')),
                ('level', models.SmallIntegerField(editable=False, help_text='The location in the hierarchy of this category.', verbose_name='Level')),
                ('creator', models.ForeignKey(editable=False, help_text='The user who created this record.', on_delete=django.db.models.deletion.CASCADE, related_name='fmonitor_category_creator_related', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
                ('parent', models.ForeignKey(blank=True, default=None, help_text='The parent to this category if any.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='fmonitor.Category', verbose_name='Parent')),
                ('updater', models.ForeignKey(editable=False, help_text='The last user to update this record.', on_delete=django.db.models.deletion.CASCADE, related_name='fmonitor_category_updater_related', to=settings.AUTH_USER_MODEL, verbose_name='Updater')),
            ],
            options={
                'verbose_name': 'Category',
                'ordering': ('path',),
                'verbose_name_plural': 'Categories',
            },
            bases=(common.model_mixins.ValidateOnSaveMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, help_text='If checked the record is active.', verbose_name='Active')),
                ('country', models.CharField(help_text='The country name.', max_length=100, verbose_name='Country')),
                ('code', models.CharField(db_index=True, help_text='The two character country code.', max_length=2, unique=True, verbose_name='Code')),
            ],
            options={
                'verbose_name': 'Country',
                'ordering': ('country',),
                'verbose_name_plural': 'Countries',
            },
        ),
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, help_text='If checked the record is active.', verbose_name='Active')),
                ('currency', models.CharField(help_text='Name of the currency.', max_length=50, verbose_name='Corrency')),
                ('alphabetic_code', models.CharField(help_text='3 digit alphabetic code for the currency.', max_length=3, verbose_name='Alphabetic Code')),
                ('numeric_code', models.PositiveSmallIntegerField(help_text='3 digit numeric code.', verbose_name='Numeric Code')),
                ('minor_unit', models.PositiveSmallIntegerField(help_text='Number of digits after the decimal separator.', verbose_name='Minor Unit')),
                ('symbol', models.CharField(blank=True, help_text='The symbol representing this currency.', max_length=6, null=True, verbose_name='Symbol')),
                ('country', models.ForeignKey(db_index=False, help_text='Country or region name.', on_delete=django.db.models.deletion.CASCADE, to='fmonitor.Country', verbose_name='Country')),
            ],
            options={
                'verbose_name': 'Currency',
                'ordering': ('country__country', 'currency'),
                'verbose_name_plural': 'Currencies',
            },
        ),
        migrations.CreateModel(
            name='Language',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, help_text='If checked the record is active.', verbose_name='Active')),
                ('locale', models.CharField(blank=True, help_text='The language and country codes.', max_length=5, unique=True, verbose_name='Locale')),
                ('code', models.CharField(help_text='The two character language code.', max_length=2, verbose_name='Language Code')),
                ('country', models.ForeignKey(help_text='The country.', on_delete=django.db.models.deletion.CASCADE, related_name='languages', to='fmonitor.Country', verbose_name='Country')),
            ],
            options={
                'verbose_name': 'Language',
                'ordering': ('locale',),
                'verbose_name_plural': 'Languages',
            },
            bases=(common.model_mixins.ValidateOnSaveMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pdt_id', models.CharField(blank=True, help_text='Public ID to identify a individual role.', max_length=30, unique=True, verbose_name='Public Product ID')),
                ('pdt_name', models.CharField(help_text='The name of this product.', max_length=250, verbose_name='Name')),
                ('pdt_descr', models.TextField(blank=True, help_text='Product description.', max_length=1000, null=True, verbose_name='Description')),
                ('units_instock', models.PositiveIntegerField()),
                ('units_onorder', models.PositiveIntegerField()),
                ('pdt_available', models.PositiveIntegerField()),
                ('reorder_level', models.PositiveIntegerField()),
                ('current_order', models.PositiveIntegerField()),
                ('note', models.TextField(blank=True, help_text='Product description.', max_length=1000, null=True, verbose_name='Description')),
                ('category', models.ForeignKey(db_index=False, help_text='The product item.', on_delete=django.db.models.deletion.CASCADE, to='fmonitor.Category', verbose_name='Supplier')),
            ],
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role_id', models.CharField(blank=True, help_text='Public ID to identify a individual role.', max_length=30, unique=True, verbose_name='Public Role ID')),
                ('role_name', models.CharField(help_text='The name of this category.', max_length=250, verbose_name='Name')),
                ('role_descr', models.TextField(blank=True, help_text='Role description.', max_length=1000, null=True, verbose_name='Description')),
            ],
            options={
                'verbose_name': 'Role',
                'verbose_name_plural': 'Roles',
            },
        ),
        migrations.CreateModel(
            name='Subdivision',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, help_text='If checked the record is active.', verbose_name='Active')),
                ('subdivision_name', models.CharField(help_text='The subdivision of the country.', max_length=130, verbose_name='State')),
                ('code', models.CharField(help_text='The subdivision code.', max_length=10, verbose_name='State Code')),
                ('country', models.ForeignKey(db_index=False, help_text='The country.', on_delete=django.db.models.deletion.CASCADE, related_name='subdivisions', to='fmonitor.Country', verbose_name='Country')),
            ],
            options={
                'verbose_name': 'Subdivision',
                'ordering': ('country', 'subdivision_name'),
                'verbose_name_plural': 'Subdivisions',
            },
        ),
        migrations.CreateModel(
            name='Supplier',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(help_text='The date and time of creation.', verbose_name='Date Created')),
                ('updated', models.DateTimeField(help_text='The date and time last updated.', verbose_name='Last Updated')),
                ('active', models.BooleanField(default=True, help_text='If checked the record is active.', verbose_name='Active')),
                ('public_id', models.CharField(blank=True, help_text='Public ID to identify a individual supplier.', max_length=30, unique=True, verbose_name='Public Supplier ID')),
                ('name', models.CharField(help_text='The name of the supplier.', max_length=250, verbose_name='Name')),
                ('address_01', models.CharField(blank=True, help_text='Address line one.', max_length=50, null=True, verbose_name='Address 1')),
                ('address_02', models.CharField(blank=True, help_text='Address line two.', max_length=50, null=True, verbose_name='Address 2')),
                ('city', models.CharField(blank=True, help_text='The city of the supplier.', max_length=30, null=True, verbose_name='City')),
                ('postal_code', models.CharField(blank=True, help_text='The postal code in the country.', max_length=15, null=True, verbose_name='Postal Code')),
                ('phone', models.CharField(blank=True, help_text='The phone number of the supplier.', max_length=20, null=True, verbose_name='Phone')),
                ('fax', models.CharField(blank=True, help_text='The fax number of the supplier', max_length=20, null=True, verbose_name='FAX')),
                ('email', models.EmailField(blank=True, help_text='The email of the supplier.', max_length=254, null=True, verbose_name='Email')),
                ('url', models.URLField(blank=True, help_text='The web site of the supplier.', null=True, verbose_name='URL')),
                ('stype', models.SmallIntegerField(choices=[(0, 'MFG & Dist'), (1, 'Manufacturer'), (2, 'Distributor')], help_text='The type of supplier.', verbose_name='Supplier Type')),
                ('country', models.ForeignKey(blank=True, help_text='The country.', null=True, on_delete=django.db.models.deletion.CASCADE, to='fmonitor.Country', verbose_name='Country')),
                ('creator', models.ForeignKey(editable=False, help_text='The user who created this record.', on_delete=django.db.models.deletion.CASCADE, related_name='fmonitor_supplier_creator_related', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
                ('language', models.ForeignKey(blank=True, help_text='The language code.', null=True, on_delete=django.db.models.deletion.CASCADE, to='fmonitor.Language', verbose_name='Language')),
                ('subdivision', models.ForeignKey(blank=True, help_text='The subdivision in the country.', null=True, on_delete=django.db.models.deletion.CASCADE, to='fmonitor.Subdivision', verbose_name='State/Province')),
            ],
            options={
                'verbose_name': 'Supplier',
                'ordering': ('name',),
                'verbose_name_plural': 'Suppliers',
            },
            bases=(common.model_mixins.ValidateOnSaveMixin, models.Model),
        ),
        migrations.CreateModel(
            name='TimeZone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, help_text='If checked the record is active.', verbose_name='Active')),
                ('zone', models.CharField(help_text='The timezone (zoneinfo).', max_length=40, verbose_name='Timezone')),
                ('coordinates', models.CharField(help_text='Latitude & Longitude.', max_length=20, verbose_name='Coordinates')),
                ('desc', models.TextField(blank=True, help_text='Zone description.', null=True, verbose_name='Description')),
                ('country', models.ForeignKey(db_index=False, help_text='The country.', on_delete=django.db.models.deletion.CASCADE, related_name='timezones', to='fmonitor.Country', verbose_name='Country')),
            ],
            options={
                'verbose_name': 'Time Zone',
                'ordering': ('zone',),
                'verbose_name_plural': 'Time Zones',
            },
        ),
        migrations.AddField(
            model_name='supplier',
            name='timezone',
            field=models.ForeignKey(blank=True, help_text='The timezone.', null=True, on_delete=django.db.models.deletion.CASCADE, to='fmonitor.TimeZone', verbose_name='Timezone'),
        ),
        migrations.AddField(
            model_name='supplier',
            name='updater',
            field=models.ForeignKey(editable=False, help_text='The last user to update this record.', on_delete=django.db.models.deletion.CASCADE, related_name='fmonitor_supplier_updater_related', to=settings.AUTH_USER_MODEL, verbose_name='Updater'),
        ),
        migrations.AddField(
            model_name='product',
            name='supplier',
            field=models.ForeignKey(db_index=False, help_text='The Distributor or manufacturer that supplied the item.', on_delete=django.db.models.deletion.CASCADE, related_name='order', to='fmonitor.Supplier', verbose_name='Supplier'),
        ),
        migrations.AlterUniqueTogether(
            name='timezone',
            unique_together={('country', 'zone')},
        ),
        migrations.AlterUniqueTogether(
            name='subdivision',
            unique_together={('country', 'code')},
        ),
        migrations.AlterUniqueTogether(
            name='currency',
            unique_together={('country', 'alphabetic_code')},
        ),
    ]
