# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-07 09:37
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
import django_extensions.db.fields
import mtp.apps.common.utils
import mtp.apps.media.fields
import mtp.apps.sync.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sync', '0003_add_index_on_update_synchornized'),
        ('contenttypes', '0002_remove_content_type_name'),
        ('trainings', '0047_add_library_status_model'),
    ]

    operations = [
        migrations.CreateModel(
            name='Media',
            fields=[
                ('id', django_extensions.db.fields.UUIDField(blank=True, editable=False, primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
            bases=(mtp.apps.sync.models.SyncableForPolymorphicMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Presentation',
            fields=[
                ('trainingactivity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='trainings.TrainingActivity')),
                ('is_accessible_by_trainees', models.BooleanField(default=True, help_text='If checked, the trainees can access the presentation by themselves', verbose_name='Is accessible by trainees')),
            ],
            options={
                'abstract': False,
            },
            bases=('trainings.trainingactivity',),
            managers=[
                ('objects', django.db.models.manager.Manager()),
                ('dependency_objects', django.db.models.manager.Manager()),
            ],
        ),
        migrations.CreateModel(
            name='PresentationMedia',
            fields=[
                ('id', django_extensions.db.fields.UUIDField(blank=True, editable=False, primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('is_restricted', models.BooleanField(default=False, verbose_name='Is restricted')),
                ('first_update', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='media_presentationmedia_by_first', to='sync.Update')),
                ('last_update', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='media_presentationmedia_by_last', to='sync.Update')),
            ],
        ),
        migrations.CreateModel(
            name='Video',
            fields=[
                ('trainingactivity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='trainings.TrainingActivity')),
            ],
            options={
                'abstract': False,
            },
            bases=('trainings.trainingactivity',),
            managers=[
                ('objects', django.db.models.manager.Manager()),
                ('dependency_objects', django.db.models.manager.Manager()),
            ],
        ),
        migrations.CreateModel(
            name='PdfMedia',
            fields=[
                ('media_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='media.Media')),
                ('file', mtp.apps.media.fields.MimeTypeRestrictedFileField(blank=True, help_text='Only PDF (max 10Mo) are allowed.', upload_to=mtp.apps.common.utils.upload_to_generator, verbose_name='Pdf file')),
            ],
            options={
                'abstract': False,
            },
            bases=('media.media',),
        ),
        migrations.CreateModel(
            name='VideoMedia',
            fields=[
                ('media_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='media.Media')),
                ('file', mtp.apps.media.fields.MimeTypeRestrictedFileField(help_text='Only MP4 files (max 200Mo) are allowed.', upload_to=mtp.apps.common.utils.upload_to_generator, verbose_name='Video file')),
            ],
            options={
                'abstract': False,
            },
            bases=('media.media',),
        ),
        migrations.AddField(
            model_name='video',
            name='media',
            field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='videos', to='media.Media'),
        ),
        migrations.AddField(
            model_name='presentationmedia',
            name='media',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='presentation_medias', to='media.Media', verbose_name='Medias'),
        ),
        migrations.AddField(
            model_name='presentationmedia',
            name='original_version',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='all_duplicates', to='media.PresentationMedia'),
        ),
        migrations.AddField(
            model_name='presentationmedia',
            name='parent_version',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='direct_duplicates', to='media.PresentationMedia'),
        ),
        migrations.AddField(
            model_name='presentationmedia',
            name='presentation',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='presentation_medias', to='media.Presentation', verbose_name='Presentation'),
        ),
        migrations.AddField(
            model_name='presentation',
            name='medias',
            field=models.ManyToManyField(related_name='presentations', through='media.PresentationMedia', to='media.Media', verbose_name='Medias'),
        ),
        migrations.AddField(
            model_name='media',
            name='first_update',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='media_media_by_first', to='sync.Update'),
        ),
        migrations.AddField(
            model_name='media',
            name='last_update',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='media_media_by_last', to='sync.Update'),
        ),
        migrations.AddField(
            model_name='media',
            name='original_version',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='all_duplicates', to='media.Media'),
        ),
        migrations.AddField(
            model_name='media',
            name='parent_version',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='direct_duplicates', to='media.Media'),
        ),
        migrations.AddField(
            model_name='media',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_media.media_set+', to='contenttypes.ContentType'),
        ),
        migrations.AlterUniqueTogether(
            name='presentationmedia',
            unique_together=set([('media', 'presentation', 'is_restricted')]),
        ),
    ]
