# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-04 13:49
from __future__ import unicode_literals

from django.conf import settings
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import ltilaunch.utils


class Migration(migrations.Migration):

    replaces = [('ltilaunch', '0001_initial'), ('ltilaunch', '0002_auto_20160804_1348')]

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='LTIToolConsumer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('description', models.TextField(blank=True)),
                ('oauth_consumer_key', models.TextField(default=ltilaunch.utils.generate_random_string, unique=True, verbose_name='OAuth consumer key')),
                ('oauth_consumer_secret', models.TextField(default=ltilaunch.utils.generate_random_string, verbose_name='OAuth consumer secret')),
                ('tool_consumer_instance_guid', models.TextField(verbose_name='Tool consumer instance GUID')),
                ('match_guid_and_consumer', models.BooleanField(default=True, verbose_name='Match GUID and OAuth consumer')),
                ('recent_nonces', django.contrib.postgres.fields.ArrayField(base_field=models.TextField(), default=[], size=10)),
                ('matcher_class_name', models.CharField(blank=True, max_length=160, null=True)),
            ],
            options={
                'verbose_name': 'LTI tool consumer',
            },
        ),
        migrations.CreateModel(
            name='LTIToolConsumerGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='LTIToolProvider',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.SlugField(unique=True)),
                ('display_name', models.CharField(max_length=50)),
                ('visibility', models.CharField(choices=[('', 'All'), ('admins', 'Admins'), ('members', 'Members')], max_length=10)),
                ('description', models.TextField()),
                ('icon_url', models.URLField(blank=True)),
                ('launch_path', models.TextField()),
            ],
            options={
                'verbose_name': 'LTI tool provider',
            },
        ),
        migrations.CreateModel(
            name='LTIUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lti_user_id', models.TextField()),
                ('last_launch_parameters', django.contrib.postgres.fields.jsonb.JSONField()),
                ('last_launch_time', models.DateTimeField()),
                ('lti_tool_consumer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ltilaunch.LTIToolConsumer')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='ltitoolconsumer',
            name='consumer_group',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='ltilaunch.LTIToolConsumerGroup'),
        ),
        migrations.AlterUniqueTogether(
            name='ltiuser',
            unique_together=set([('lti_tool_consumer', 'lti_user_id')]),
        ),
        migrations.AlterModelOptions(
            name='ltitoolconsumergroup',
            options={'verbose_name': 'LTI tool consumer group'},
        ),
        migrations.AlterModelOptions(
            name='ltiuser',
            options={'verbose_name': 'LTI user'},
        ),
    ]
