# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import mtp.apps.common.utils
import django_extensions.db.fields
from django.conf import settings


class Migration(migrations.Migration):

    dependencies = [
        ('sync', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('accounts', '0001_initial'),
        ('trainings', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='BackgroundExecution',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('begin_date', models.TimeField()),
                ('end_date', models.TimeField()),
                ('action', models.CharField(choices=[('op', 'open'), ('po', 'popin'), ('pp', 'popin open'), ('lo', 'locked'), ('au', 'authorization')], max_length=20)),
                ('title', models.CharField(blank=True, max_length=50)),
                ('description', models.CharField(blank=True, max_length=250)),
                ('locked', models.BooleanField(default=False)),
                ('auto_mgroups', models.ManyToManyField(to='accounts.Group', related_name='bg_exec_auto_mgroups')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('name', models.CharField(verbose_name='document name', blank=True, db_index=True, max_length=255)),
                ('master', models.BooleanField(default=False)),
                ('trainer', models.BooleanField(default=False, verbose_name='only trainer')),
                ('hidden', models.BooleanField(default=False, verbose_name='hidden')),
                ('order', models.PositiveIntegerField(null=True, verbose_name='order', blank=True, db_index=True)),
            ],
            options={
                'ordering': ('order',),
            },
        ),
        migrations.CreateModel(
            name='DocumentCommentFile',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('orig_file', models.FileField(verbose_name='comment file', upload_to=mtp.apps.common.utils.upload_to_generator)),
                ('hash', models.CharField(blank=True, max_length=36)),
                ('first_update', models.ForeignKey(null=True, related_name='documentcommentfile_by_first', to='sync.Update', blank=True)),
                ('last_update', models.ForeignKey(null=True, related_name='documentcommentfile_by_last', to='sync.Update', blank=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DocumentFile',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('orig_file', models.FileField(verbose_name='projected file', upload_to=mtp.apps.common.utils.upload_to_generator)),
                ('doc_type', models.CharField(choices=[('txt', 'Text'), ('pdf', 'PDF'), ('vid', 'Video'), ('ppt', 'PPT'), ('oth', 'Other')], max_length=3)),
                ('hash', models.CharField(blank=True, max_length=36)),
                ('first_update', models.ForeignKey(null=True, related_name='documentfile_by_first', to='sync.Update', blank=True)),
                ('last_update', models.ForeignKey(null=True, related_name='documentfile_by_last', to='sync.Update', blank=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DownloadableFile',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('img', models.ImageField(null=True, verbose_name='image', blank=True, upload_to=mtp.apps.common.utils.upload_to_generator)),
                ('hash', models.CharField(null=True, default='d41d8cd98f00b204e9800998ecf8427e', blank=True, max_length=36)),
                ('order', models.PositiveIntegerField(null=True, blank=True, db_index=True)),
                ('first_update', models.ForeignKey(null=True, related_name='downloadablefile_by_first', to='sync.Update', blank=True)),
                ('last_update', models.ForeignKey(null=True, related_name='downloadablefile_by_last', to='sync.Update', blank=True)),
                ('original', models.ForeignKey(null=True, to='documents.DownloadableFile', blank=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Note',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('page', models.PositiveIntegerField()),
                ('x', models.FloatField()),
                ('y', models.FloatField()),
                ('w', models.FloatField()),
                ('h', models.FloatField()),
                ('text', models.TextField()),
                ('note_type', models.CharField(max_length=100)),
                ('document', models.ForeignKey(null=True, to='documents.Document', blank=True)),
                ('first_update', models.ForeignKey(null=True, related_name='note_by_first', to='sync.Update', blank=True)),
                ('last_update', models.ForeignKey(null=True, related_name='note_by_last', to='sync.Update', blank=True)),
                ('training', models.ForeignKey(to='trainings.Training')),
                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PDFGenerationRequest',
            fields=[
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, primary_key=True, editable=False)),
                ('done', models.BooleanField(default=False)),
                ('document', models.ForeignKey(to='documents.Document')),
                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='documentfile',
            name='preview',
            field=models.ForeignKey(null=True, to='documents.DownloadableFile'),
        ),
        migrations.AddField(
            model_name='document',
            name='doc_file',
            field=models.ForeignKey(null=True, verbose_name='trainee file', to='documents.DocumentFile', blank=True),
        ),
        migrations.AddField(
            model_name='document',
            name='doc_file_comment',
            field=models.ForeignKey(null=True, verbose_name='trainer file', to='documents.DocumentCommentFile', blank=True),
        ),
        migrations.AddField(
            model_name='document',
            name='first_update',
            field=models.ForeignKey(null=True, related_name='document_by_first', to='sync.Update', blank=True),
        ),
        migrations.AddField(
            model_name='document',
            name='last_update',
            field=models.ForeignKey(null=True, related_name='document_by_last', to='sync.Update', blank=True),
        ),
        migrations.AddField(
            model_name='document',
            name='mgroups',
            field=models.ManyToManyField(to='accounts.Group'),
        ),
        migrations.AddField(
            model_name='document',
            name='original',
            field=models.ForeignKey(null=True, to='documents.Document', blank=True),
        ),
        migrations.AddField(
            model_name='document',
            name='training',
            field=models.ForeignKey(verbose_name='training', to='trainings.Training'),
        ),
        migrations.AddField(
            model_name='document',
            name='user',
            field=models.ForeignKey(null=True, verbose_name='trainer', to=settings.AUTH_USER_MODEL, blank=True),
        ),
        migrations.AddField(
            model_name='backgroundexecution',
            name='document',
            field=models.ForeignKey(null=True, to='documents.Document', blank=True),
        ),
        migrations.AddField(
            model_name='backgroundexecution',
            name='first_update',
            field=models.ForeignKey(null=True, related_name='backgroundexecution_by_first', to='sync.Update', blank=True),
        ),
        migrations.AddField(
            model_name='backgroundexecution',
            name='last_update',
            field=models.ForeignKey(null=True, related_name='backgroundexecution_by_last', to='sync.Update', blank=True),
        ),
        migrations.AddField(
            model_name='backgroundexecution',
            name='mgroups',
            field=models.ManyToManyField(to='accounts.Group', related_name='bg_exec_mgroups'),
        ),
    ]
