# Generated by Django 3.1.1 on 2020-11-01 14:02

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import quaddicted.packages.models
import taggit.managers


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('taggit', '0003_taggeditem_add_unique_index'),
    ]

    operations = [
        migrations.CreateModel(
            name='Package',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(max_length=256, upload_to=quaddicted.packages.models.package_upload_to, validators=[quaddicted.packages.models.validate_package_file])),
                ('file_name', models.CharField(blank=True, editable=False, max_length=128)),
                ('file_hash', models.CharField(blank=True, editable=False, max_length=64, unique=True)),
                ('file_size', models.BigIntegerField(blank=True, editable=False, null=True)),
                ('name', models.CharField(max_length=128)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('rating', models.FloatField(blank=True, editable=False, null=True)),
                ('game', models.CharField(choices=[('q1', 'Quake 1'), ('q2', 'Quake 2'), ('q3', 'Quake 3')], default='q1', max_length=2)),
                ('description', models.TextField(blank=True)),
                ('type', models.IntegerField(choices=[(1, 'Single BSP File(s)'), (2, 'Partial conversion'), (3, 'Total conversion'), (4, 'Speedmapping'), (5, 'Misc. Files'), (6, 'undefined, please tell Spirit')], default=6)),
                ('published', models.BooleanField(default=False)),
                ('uploaded_on', models.DateTimeField(auto_now_add=True)),
                ('base_dir', models.CharField(blank=True, help_text='directory where this package should be extracted to', max_length=256, null=True)),
                ('command_line', models.CharField(blank=True, help_text='command-line arguments for running the package', max_length=256, null=True)),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='PackageAuthor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True, verbose_name='name')),
                ('slug', models.SlugField(max_length=100, unique=True, verbose_name='slug')),
            ],
            options={
                'verbose_name': 'Package Author',
                'verbose_name_plural': 'Package Authors',
            },
        ),
        migrations.CreateModel(
            name='PackageUrl',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
                ('url', models.URLField()),
                ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='urls', to='quaddicted_packages.package')),
            ],
        ),
        migrations.CreateModel(
            name='PackageScreenshot',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(help_text='A 16x9 resolution image at least 1024x576', max_length=256, upload_to=quaddicted.packages.models.screenshot_upload_to)),
                ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='screenshots', to='quaddicted_packages.package')),
            ],
        ),
        migrations.CreateModel(
            name='PackageFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('last_modified', models.DateTimeField(auto_now_add=True)),
                ('size', models.BigIntegerField(blank=True, editable=False, null=True)),
                ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='quaddicted_packages.package')),
            ],
        ),
        migrations.AddField(
            model_name='package',
            name='authors',
            field=models.ManyToManyField(help_text='A comma-separated list of authors.', related_name='packages', to='quaddicted_packages.PackageAuthor'),
        ),
        migrations.AddField(
            model_name='package',
            name='dependencies',
            field=models.ManyToManyField(to='quaddicted_packages.Package'),
        ),
        migrations.AddField(
            model_name='package',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='package',
            name='uploaded_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='PackageRating',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('username', models.CharField(blank=True, max_length=32, null=True)),
                ('score', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ratings', to='quaddicted_packages.package')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('user', 'package'), ('username', 'package')},
            },
        ),
    ]
