# Generated by Django 2.1.9 on 2019-06-24 22:49

import apps.rmanager.fields
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_fsm
import model_utils.fields
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('bhs', '0001_initial'),
        ('cmanager', '0001_initial'),
        ('smanager', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Appearance',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', django_fsm.FSMIntegerField(choices=[(-30, 'Disqualified'), (-20, 'Scratched'), (-10, 'Completed'), (0, 'New'), (7, 'Built'), (10, 'Started'), (20, 'Finished'), (25, 'Variance'), (30, 'Verified'), (40, 'Advanced')], default=0, help_text='DO NOT CHANGE MANUALLY unless correcting a mistake.  Use the buttons to change state.')),
                ('num', models.IntegerField(help_text='The order of appearance for this round.')),
                ('draw', models.IntegerField(blank=True, help_text='The draw for the next round.', null=True)),
                ('is_private', models.BooleanField(default=False, help_text='Copied from entry.')),
                ('is_single', models.BooleanField(default=False, help_text='Single-round group')),
                ('participants', models.CharField(blank=True, default='', help_text='Director(s) or Members (listed TLBB)', max_length=255)),
                ('representing', models.CharField(blank=True, default='', help_text='Representing entity', max_length=255)),
                ('onstage', models.DateTimeField(blank=True, help_text='\n            The actual appearance datetime.', null=True)),
                ('actual_start', models.DateTimeField(blank=True, help_text='\n            The actual appearance datetime.', null=True)),
                ('actual_finish', models.DateTimeField(blank=True, help_text='\n            The actual appearance datetime.', null=True)),
                ('pos', models.IntegerField(blank=True, help_text='Actual Participants-on-Stage', null=True)),
                ('legacy_group', models.CharField(blank=True, default='', max_length=255)),
                ('stats', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('base', models.FloatField(blank=True, help_text='\n            The incoming base score used to determine most-improved winners.', null=True)),
                ('variance_report', models.FileField(blank=True, default='', upload_to=apps.rmanager.fields.FileUploadPath())),
                ('csa', models.FileField(blank=True, default='', upload_to=apps.rmanager.fields.FileUploadPath())),
                ('entry', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='appearances', to='smanager.Entry')),
                ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='appearances', to='bhs.Group')),
            ],
            options={
                'ordering': ['-round__num', 'num'],
            },
        ),
        migrations.CreateModel(
            name='Contender',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', django_fsm.FSMIntegerField(choices=[(-10, 'Excluded'), (0, 'New'), (10, 'Included')], default=0, help_text='DO NOT CHANGE MANUALLY unless correcting a mistake.  Use the buttons to change state.')),
                ('appearance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contenders', to='rmanager.Appearance')),
            ],
            options={
                'ordering': ('outcome__num',),
            },
        ),
        migrations.CreateModel(
            name='Outcome',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', models.IntegerField(choices=[(-10, 'Inactive'), (0, 'New'), (10, 'Active')], default=0)),
                ('num', models.IntegerField(blank=True, null=True)),
                ('name', models.CharField(blank=True, max_length=1024, null=True)),
                ('legacy_num', models.IntegerField(blank=True, null=True)),
                ('legacy_name', models.CharField(blank=True, max_length=1024, null=True)),
                ('award', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outcomes', to='cmanager.Award')),
            ],
        ),
        migrations.CreateModel(
            name='Panelist',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', django_fsm.FSMIntegerField(choices=[(-10, 'Inactive'), (-5, 'Released'), (0, 'New'), (10, 'Active')], default=10, help_text='DO NOT CHANGE MANUALLY unless correcting a mistake.  Use the buttons to change state.')),
                ('num', models.IntegerField(blank=True, null=True)),
                ('kind', models.IntegerField(choices=[(10, 'Official'), (20, 'Practice'), (30, 'Observer')])),
                ('category', models.IntegerField(blank=True, choices=[(5, 'DRCJ'), (10, 'CA'), (30, 'Music'), (40, 'Performance'), (50, 'Singing')], null=True)),
                ('psa', models.FileField(blank=True, default='', upload_to=apps.rmanager.fields.FileUploadPath())),
                ('legacy_person', models.CharField(blank=True, max_length=255, null=True)),
                ('representing', models.CharField(blank=True, default='', max_length=255)),
                ('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='panelists', to='bhs.Person')),
            ],
        ),
        migrations.CreateModel(
            name='Round',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', django_fsm.FSMIntegerField(choices=[(0, 'New'), (10, 'Built'), (20, 'Started'), (25, 'Completed'), (27, 'Verified'), (30, 'Published')], default=0, help_text='DO NOT CHANGE MANUALLY unless correcting a mistake.  Use the buttons to change state.')),
                ('kind', models.IntegerField(choices=[(1, 'Finals'), (2, 'Semi-Finals'), (3, 'Quarter-Finals')])),
                ('num', models.IntegerField(default=0)),
                ('spots', models.IntegerField(default=0)),
                ('date', models.DateField(blank=True, null=True)),
                ('footnotes', models.TextField(blank=True, help_text='\n            Freeform text field; will print on OSS.')),
                ('oss', models.FileField(blank=True, default='', upload_to=apps.rmanager.fields.FileUploadPath())),
                ('legacy_oss', models.FileField(blank=True, default='', upload_to=apps.rmanager.fields.FileUploadPath())),
                ('sa', models.FileField(blank=True, default='', upload_to=apps.rmanager.fields.FileUploadPath())),
                ('is_reviewed', models.BooleanField(default=False, help_text='Reviewed for history app')),
                ('session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rounds', to='smanager.Session')),
            ],
            options={
                'get_latest_by': ['num'],
            },
        ),
        migrations.CreateModel(
            name='Score',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', django_fsm.FSMIntegerField(choices=[(0, 'New'), (10, 'Verified'), (25, 'Cleared'), (30, 'Flagged'), (35, 'Revised'), (40, 'Confirmed')], default=0, help_text='DO NOT CHANGE MANUALLY unless correcting a mistake.  Use the buttons to change state.')),
                ('points', models.IntegerField(blank=True, help_text='\n            The number of points (0-100)', null=True, validators=[django.core.validators.MaxValueValidator(100, message='Points must be between 0 - 100'), django.core.validators.MinValueValidator(0, message='Points must be between 0 - 100')])),
                ('panelist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='scores', to='rmanager.Panelist')),
            ],
        ),
        migrations.CreateModel(
            name='Song',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', django_fsm.FSMIntegerField(choices=[(0, 'New'), (10, 'Verified'), (38, 'Finished'), (40, 'Confirmed'), (50, 'Final'), (90, 'Announced'), (95, 'Archived')], default=0, help_text='DO NOT CHANGE MANUALLY unless correcting a mistake.  Use the buttons to change state.')),
                ('num', models.IntegerField()),
                ('legacy_chart', models.CharField(blank=True, max_length=255, null=True)),
                ('asterisks', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, default=list, size=None)),
                ('dixons', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, default=list, size=None)),
                ('penalties', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(choices=[(10, 'Primarily Patriotic/Religious Intent'), (30, 'Instrumental Accompaniment'), (40, 'Chorus Exceeding 4-Part Texture'), (50, 'Sound Equipment or Electronic Enhancement')]), blank=True, default=list, size=None)),
                ('stats', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('appearance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='songs', to='rmanager.Appearance')),
                ('chart', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='songs', to='bhs.Chart')),
            ],
            options={
                'get_latest_by': ['num'],
            },
        ),
        migrations.AddField(
            model_name='score',
            name='song',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='scores', to='rmanager.Song'),
        ),
        migrations.AddField(
            model_name='panelist',
            name='round',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='panelists', to='rmanager.Round'),
        ),
        migrations.AddField(
            model_name='outcome',
            name='round',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outcomes', to='rmanager.Round'),
        ),
        migrations.AddField(
            model_name='contender',
            name='outcome',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contenders', to='rmanager.Outcome'),
        ),
        migrations.AddField(
            model_name='appearance',
            name='round',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='appearances', to='rmanager.Round'),
        ),
        migrations.AlterUniqueTogether(
            name='song',
            unique_together={('appearance', 'num')},
        ),
        migrations.AlterUniqueTogether(
            name='score',
            unique_together={('song', 'panelist')},
        ),
        migrations.AlterUniqueTogether(
            name='round',
            unique_together={('session', 'kind')},
        ),
        migrations.AlterUniqueTogether(
            name='panelist',
            unique_together={('round', 'person', 'category'), ('round', 'num')},
        ),
        migrations.AlterUniqueTogether(
            name='outcome',
            unique_together={('round', 'award'), ('round', 'num')},
        ),
        migrations.AlterUniqueTogether(
            name='contender',
            unique_together={('appearance', 'outcome')},
        ),
        migrations.AlterUniqueTogether(
            name='appearance',
            unique_together={('round', 'num')},
        ),
    ]
