# Generated by Django 2.2.2 on 2019-07-05 16:37

import autoslug.fields
import chunked_upload.models
import chunked_upload.settings
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='Video',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(default='Untitled', max_length=50)),
                ('description', models.TextField(default='')),
                ('public', models.BooleanField(choices=[(False, 'No'), (True, 'Yes')], default=False)),
                ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='title', unique=True)),
                ('thumbnail', models.FileField(null=True, upload_to='')),
                ('upload_id', models.CharField(max_length=50)),
                ('vid_info_str', models.TextField(null=True)),
                ('folder_path', models.CharField(max_length=100, null=True)),
                ('processed', models.BooleanField(default=False)),
                ('processing_id', models.CharField(max_length=100, null=True)),
                ('master_playlist', models.FileField(null=True, upload_to='')),
            ],
        ),
        migrations.CreateModel(
            name='VideoCollection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.CharField(max_length=50, null=True)),
                ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='title', unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='VideoVariant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('playlist_file', models.FileField(upload_to='')),
                ('video_file', models.FileField(upload_to='')),
                ('resolution', models.SmallIntegerField()),
                ('master', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variants', to='video.Video')),
            ],
        ),
        migrations.CreateModel(
            name='VideoCollectionOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order', models.PositiveIntegerField(db_index=True, editable=False, verbose_name='order')),
                ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='video.VideoCollection')),
                ('video', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='video.Video')),
            ],
            options={
                'ordering': ('collection', 'order'),
                'abstract': False,
                'unique_together': {('collection', 'order')},
            },
        ),
        migrations.CreateModel(
            name='VideoChunkedUpload',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('upload_id', models.CharField(default=chunked_upload.models.generate_upload_id, editable=False, max_length=32, unique=True)),
                ('file', models.FileField(max_length=255, upload_to=chunked_upload.settings.default_upload_to)),
                ('filename', models.CharField(max_length=255)),
                ('offset', models.BigIntegerField(default=0)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('status', models.PositiveSmallIntegerField(choices=[(1, 'Uploading'), (2, 'Complete')], default=1)),
                ('completed_on', models.DateTimeField(blank=True, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunked_uploads', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='video',
            name='collections',
            field=models.ManyToManyField(related_name='videos', through='video.VideoCollectionOrder', to='video.VideoCollection'),
        ),
        migrations.AddField(
            model_name='video',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
    ]
