# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-19 23:18
from __future__ import unicode_literals

from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import fluwebvirus.formatChecker
import managing_files.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('manage_virus', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CountVariations',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('total', models.PositiveIntegerField(default=0)),
                ('var_less_50', models.PositiveIntegerField(default=0)),
                ('var_bigger_50_90', models.PositiveIntegerField(default=0)),
                ('var_bigger_90', models.PositiveIntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='DataSet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Date creation')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='data_set', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['creation_date', 'name'],
            },
        ),
        migrations.CreateModel(
            name='MetaKey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=200, null=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='MetaKeyProject',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='uploaded date')),
                ('value', models.CharField(default='value not needed', max_length=200)),
                ('description', models.TextField(default='')),
                ('meta_tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_project', to='managing_files.MetaKey')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_project', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['project__id', '-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='MetaKeyProjectSample',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='uploaded date')),
                ('value', models.CharField(default='value not needed', max_length=200)),
                ('description', models.TextField(default='')),
                ('meta_tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_project_sample', to='managing_files.MetaKey')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_project_sample', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['project_sample__id', '-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='MetaKeyReference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='uploaded date')),
                ('value', models.CharField(default='value not needed', max_length=200)),
                ('description', models.TextField(default='')),
                ('meta_tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_reference', to='managing_files.MetaKey')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_reference', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['reference__id', '-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='MetaKeySample',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='uploaded date')),
                ('value', models.CharField(default='value not needed', max_length=200)),
                ('description', models.TextField(default='')),
                ('meta_tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_sample', to='managing_files.MetaKey')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_sample', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['sample__id', '-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='MixedInfections',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('average_value', models.FloatField(default=0.0)),
                ('description', models.TextField(default='')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='uploaded date')),
                ('has_master_vector', models.BooleanField(default=False)),
            ],
            options={
                'ordering': ['tag'],
            },
        ),
        migrations.CreateModel(
            name='MixedInfectionsTag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=50, null=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=200, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='uploaded date')),
                ('is_deleted', models.BooleanField(default=False)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='project', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='ProjectSample',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='uploaded date')),
                ('is_finished', models.BooleanField(default=False)),
                ('is_deleted', models.BooleanField(default=False)),
                ('is_error', models.BooleanField(default=False)),
                ('alert_first_level', models.IntegerField(default=0)),
                ('alert_second_level', models.IntegerField(default=0)),
                ('count_variations', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='project_sample', to='managing_files.CountVariations')),
                ('mixed_infections', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='project_sample', to='managing_files.MixedInfections')),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='project_sample', to='managing_files.Project')),
            ],
            options={
                'ordering': ['project__id', '-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='Reference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=200, verbose_name='Reference name')),
                ('isolate_name', models.CharField(default='', max_length=200, verbose_name='Isolate Name')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Uploaded Date')),
                ('reference_fasta', fluwebvirus.formatChecker.ContentTypeRestrictedFileField(blank=True, max_length=500, null=True, upload_to=managing_files.models.reference_directory_path)),
                ('reference_fasta_name', models.CharField(default='', max_length=200, verbose_name='Fasta file')),
                ('hash_reference_fasta', models.CharField(blank=True, max_length=50, null=True)),
                ('reference_genbank', fluwebvirus.formatChecker.ContentTypeRestrictedFileField(blank=True, max_length=500, null=True, upload_to=managing_files.models.reference_directory_path)),
                ('reference_genbank_name', models.CharField(default='', max_length=200, verbose_name='Genbank file')),
                ('hash_reference_genbank', models.CharField(blank=True, max_length=50, null=True)),
                ('is_obsolete', models.BooleanField(default=False, verbose_name='Obsolete')),
                ('number_of_locus', models.IntegerField(default=0, verbose_name='#Sequences')),
                ('description', models.CharField(blank=True, default='', max_length=500, null=True, verbose_name='Description')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reference', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Reference',
                'ordering': ['-creation_date'],
                'verbose_name_plural': 'References',
            },
        ),
        migrations.CreateModel(
            name='Sample',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=200, null=True)),
                ('date_of_onset', models.DateField(blank=True, null=True, verbose_name='date of onset')),
                ('date_of_collection', models.DateField(blank=True, null=True, verbose_name='date of collection')),
                ('date_of_receipt_lab', models.DateField(blank=True, null=True, verbose_name='date of receipt lab')),
                ('week', models.IntegerField(blank=True, null=True)),
                ('day', models.IntegerField(blank=True, null=True)),
                ('month', models.IntegerField(blank=True, null=True)),
                ('year', models.IntegerField(blank=True, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Uploaded Date')),
                ('is_rejected', models.BooleanField(default=False)),
                ('is_obsolete', models.BooleanField(default=False)),
                ('geo_local', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)),
                ('type_subtype', models.CharField(blank=True, max_length=50, null=True)),
                ('is_valid_1', models.BooleanField(default=False)),
                ('file_name_1', models.CharField(blank=True, max_length=300, null=True)),
                ('path_name_1', fluwebvirus.formatChecker.ContentTypeRestrictedFileField(blank=True, max_length=500, null=True, upload_to=managing_files.models.user_directory_path)),
                ('is_valid_2', models.BooleanField(default=False)),
                ('file_name_2', models.CharField(blank=True, max_length=300, null=True)),
                ('path_name_2', fluwebvirus.formatChecker.ContentTypeRestrictedFileField(blank=True, max_length=500, null=True, upload_to=managing_files.models.user_directory_path)),
                ('has_files', models.BooleanField(default=False)),
                ('is_ready_for_projects', models.BooleanField(default=False)),
                ('data_set', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sample', to='managing_files.DataSet')),
                ('identify_virus', models.ManyToManyField(to='manage_virus.IdentifyVirus')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sample', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='SeasonReference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Date creation')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='season_reference', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Software',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=100, null=True)),
                ('path_to_run', models.CharField(max_length=300)),
            ],
            options={
                'ordering': ['name', 'version__name'],
            },
        ),
        migrations.CreateModel(
            name='Statistics',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.FloatField(default=0.0)),
            ],
        ),
        migrations.CreateModel(
            name='TagName',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Uploaded Date')),
                ('is_meta_data', models.BooleanField(default=False)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tag_name', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='TagNames',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=150)),
                ('sample', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='managing_files.Sample')),
                ('tag_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='managing_files.TagName')),
            ],
        ),
        migrations.CreateModel(
            name='UploadFiles',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_valid', models.BooleanField(default=False)),
                ('is_samples_list', models.BooleanField(default=False)),
                ('is_processed', models.BooleanField(default=False)),
                ('is_first_fastq_file', models.BooleanField(default=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('number_errors', models.IntegerField(default=0)),
                ('number_files_processed', models.IntegerField(default=0)),
                ('file_name', models.CharField(blank=True, max_length=300, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='upload_files')),
                ('path_name', fluwebvirus.formatChecker.ContentTypeRestrictedFileField(blank=True, max_length=500, null=True, upload_to=managing_files.models.user_directory_path)),
                ('description', models.TextField(default='')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='upload_files', to=settings.AUTH_USER_MODEL)),
                ('sample', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='upload_files', to='managing_files.Sample')),
                ('upload_file', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='managing_files.UploadFiles')),
            ],
            options={
                'ordering': ['creation_date'],
            },
        ),
        migrations.CreateModel(
            name='VaccineStatus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Date creation')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='vaccine_status', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['creation_date', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Version',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.AddField(
            model_name='statistics',
            name='tag',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='statistics', to='managing_files.TagName'),
        ),
        migrations.AddField(
            model_name='software',
            name='version',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='software', to='managing_files.Version'),
        ),
        migrations.AddField(
            model_name='sample',
            name='tag_names',
            field=models.ManyToManyField(through='managing_files.TagNames', to='managing_files.TagName'),
        ),
        migrations.AddField(
            model_name='sample',
            name='vaccine_status',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sample', to='managing_files.VaccineStatus'),
        ),
        migrations.AddField(
            model_name='reference',
            name='season',
            field=models.ManyToManyField(to='managing_files.SeasonReference'),
        ),
        migrations.AddField(
            model_name='projectsample',
            name='sample',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='project_sample', to='managing_files.Sample'),
        ),
        migrations.AddField(
            model_name='project',
            name='reference',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='project', to='managing_files.Reference'),
        ),
        migrations.AddField(
            model_name='mixedinfections',
            name='tag',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='mixed_infections', to='managing_files.MixedInfectionsTag'),
        ),
        migrations.AddField(
            model_name='metakeysample',
            name='sample',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_sample', to='managing_files.Sample'),
        ),
        migrations.AddField(
            model_name='metakeyreference',
            name='reference',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_reference', to='managing_files.Reference'),
        ),
        migrations.AddField(
            model_name='metakeyprojectsample',
            name='project_sample',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_project_sample', to='managing_files.ProjectSample'),
        ),
        migrations.AddField(
            model_name='metakeyproject',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meta_key_project', to='managing_files.Project'),
        ),
        migrations.AddIndex(
            model_name='reference',
            index=models.Index(fields=['name'], name='name_idx'),
        ),
    ]
