# Generated by Django 3.0.4 on 2020-03-26 02:06

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Distributor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('contact', models.CharField(max_length=300)),
            ],
        ),
        migrations.CreateModel(
            name='DocumentType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file_type', models.CharField(max_length=100)),
                ('description', models.CharField(blank=True, max_length=200, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Equipment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('product_type', models.CharField(choices=[('E', 'Equipamento Protecao Individual'), ('V', 'Ventilador'), ('T', 'Kit Teste'), ('O', 'Outro')], max_length=1)),
                ('model', models.CharField(max_length=100)),
                ('manufacturer_reference', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='HealthProfessional',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='HealthUnit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Manufacturer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Process',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.IntegerField(blank=True, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Procurement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('procurement_type', models.CharField(choices=[('D', 'Donation'), ('C', 'Commercial')], max_length=1)),
                ('availability', models.CharField(blank=True, max_length=100, null=True)),
                ('min_order_quantity', models.IntegerField(blank=True, null=True)),
                ('picture', models.ImageField(upload_to='images')),
                ('price_per_unit', models.IntegerField(blank=True, null=True)),
                ('price_total', models.IntegerField(blank=True, null=True)),
                ('currency', models.CharField(blank=True, choices=[('D', 'dollar'), ('E', 'euro')], max_length=1, null=True)),
                ('payment_terms', models.CharField(blank=True, max_length=200, null=True)),
                ('delivery_time', models.CharField(blank=True, max_length=50, null=True)),
                ('comments', models.TextField(blank=True, null=True)),
                ('ce_certified', models.NullBooleanField()),
                ('fda_certified', models.NullBooleanField()),
                ('equipment', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='erp.Equipment')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Process')),
            ],
        ),
        migrations.CreateModel(
            name='Supplier',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('email', models.EmailField(blank=True, max_length=254, null=True)),
                ('phone', models.CharField(blank=True, max_length=32, null=True)),
                ('lead', models.CharField(blank=True, max_length=32, null=True)),
                ('origin', django_countries.fields.CountryField(blank=True, max_length=2, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Warehouse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Stock',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('loading_point', models.CharField(blank=True, max_length=100, null=True)),
                ('creation_date', models.DateField(blank=True, null=True)),
                ('quantity', models.IntegerField(blank=True, null=True)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Process')),
                ('warehouse', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='erp.Warehouse')),
            ],
        ),
        migrations.CreateModel(
            name='Request',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.IntegerField(blank=True, null=True)),
                ('maximum_available', models.BooleanField()),
                ('equipment', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='erp.Equipment')),
                ('health_professional', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='erp.HealthProfessional')),
                ('health_unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='erp.HealthUnit')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Process')),
            ],
        ),
        migrations.CreateModel(
            name='PurchaseValidation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('health_professional', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='erp.HealthProfessional')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Process')),
            ],
        ),
        migrations.CreateModel(
            name='PurchaseOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(blank=True, max_length=30, null=True)),
                ('creation_date', models.DateTimeField(blank=True, null=True)),
                ('payment_method', models.CharField(blank=True, max_length=30, null=True)),
                ('payment_date', models.DateField(blank=True, null=True)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Process')),
            ],
        ),
        migrations.CreateModel(
            name='ProcurementDocument',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(upload_to='files')),
                ('file_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='erp.DocumentType')),
                ('procurement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Procurement')),
            ],
        ),
        migrations.AddField(
            model_name='procurement',
            name='supplier',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='erp.Supplier'),
        ),
        migrations.AddField(
            model_name='equipment',
            name='manufacturer',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='erp.Manufacturer'),
        ),
        migrations.CreateModel(
            name='Distribution',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('location', models.CharField(blank=True, max_length=100, null=True)),
                ('distributor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='erp.Distributor')),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Process')),
            ],
        ),
    ]
