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

from django.db import models, migrations
from django.conf import settings
import django_extensions.db.fields


class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Action',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, editable=False, primary_key=True)),
                ('action', models.CharField(choices=[('open', 'open'), ('popin', 'popin'), ('popin open', 'popin open'), ('locked', 'locked'), ('authorization', 'authorization')], max_length=20)),
                ('module', models.CharField(choices=[('who_is_who', 'who_is_who'), ('document', 'document'), ('plan_meta', 'plan_meta'), ('buzzer', 'buzzer'), ('spider_graph', 'spider_graph')], max_length=40)),
                ('module_id', models.CharField(max_length=100)),
                ('external_id', models.CharField(max_length=100)),
                ('first_update', models.ForeignKey(related_name='action_by_first', blank=True, to='sync.Update', null=True)),
                ('last_update', models.ForeignKey(related_name='action_by_last', blank=True, to='sync.Update', null=True)),
                ('mgroups', models.ManyToManyField(to='accounts.Group')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CurrentSession',
            fields=[
                ('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
            ],
        ),
        migrations.CreateModel(
            name='Training',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, editable=False, primary_key=True)),
                ('name', models.CharField(unique=True, verbose_name='name', max_length=30, db_index=True)),
                ('description', models.TextField(blank=True)),
                ('addition_lock', models.BooleanField(verbose_name='addition lock', default=False)),
                ('modification_lock', models.BooleanField(verbose_name='modification lock', default=False)),
                ('order_lock', models.BooleanField(verbose_name='order lock', default=False)),
                ('hidden_lock', models.BooleanField(verbose_name='hidden lock', default=False)),
                ('public', models.BooleanField(verbose_name='publish', default=False)),
                ('version', models.PositiveIntegerField(default=0)),
                ('default_group_set', models.ForeignKey(blank=True, to='accounts.GroupSet', verbose_name='default group set', null=True)),
                ('first_update', models.ForeignKey(related_name='training_by_first', blank=True, to='sync.Update', null=True)),
                ('last_update', models.ForeignKey(related_name='training_by_last', blank=True, to='sync.Update', null=True)),
                ('theme', models.ForeignKey(to='themes.Theme', verbose_name='theme', null=True)),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='TrainingSession',
            fields=[
                ('is_deleted', models.BooleanField(default=False)),
                ('update_locally', models.BooleanField(default=False)),
                ('id', django_extensions.db.fields.UUIDField(serialize=False, blank=True, editable=False, primary_key=True)),
                ('date', models.DateTimeField(verbose_name='start date', db_index=True)),
                ('date_end', models.DateTimeField(verbose_name='end date')),
                ('state', models.CharField(choices=[('no', 'Not open'), ('be', 'Before'), ('du', 'During'), ('af', 'After'), ('cl', 'Closed')], default='du', max_length=2, db_index=True)),
                ('permissions', models.CharField(choices=[('op', 'Open'), ('na', 'Approval needed'), ('re', 'Restricted')], default='op', max_length=2, db_index=True)),
                ('first_update', models.ForeignKey(related_name='trainingsession_by_first', blank=True, to='sync.Update', null=True)),
                ('last_update', models.ForeignKey(related_name='trainingsession_by_last', blank=True, to='sync.Update', null=True)),
                ('trainer', models.ForeignKey(related_name='trainer', to=settings.AUTH_USER_MODEL, verbose_name='trainer')),
                ('training', models.ForeignKey(to='trainings.Training', verbose_name='training')),
                ('users', models.ManyToManyField(related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='trainee')),
            ],
            options={
                'ordering': ('date',),
            },
        ),
        migrations.AddField(
            model_name='currentsession',
            name='session',
            field=models.ForeignKey(to='trainings.TrainingSession'),
        ),
        migrations.AddField(
            model_name='action',
            name='training',
            field=models.ForeignKey(to='trainings.Training'),
        ),
        migrations.AddField(
            model_name='action',
            name='user',
            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='trainer', null=True),
        ),
    ]
