# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-03-26 17:56
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_fsm
import model_utils.fields
import waldur_core.core.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('structure', '0054_payment_details'),
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('python_management', '0003_added_unique_constraint'),
    ]

    operations = [
        migrations.CreateModel(
            name='JupyterHubManagement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('session_time_to_live_hours', models.IntegerField(default=24)),
                ('instance_object_id', models.PositiveIntegerField(null=True)),
                ('instance_content_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.ContentType')),
            ],
        ),
        migrations.CreateModel(
            name='JupyterHubManagementDeleteRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('output', models.TextField(blank=True)),
                ('jupyter_hub_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='jupyter_hub_management.JupyterHubManagement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='JupyterHubManagementMakeVirtualEnvironmentGlobalRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('virtual_env_name', models.CharField(max_length=255)),
                ('output', models.TextField(blank=True)),
                ('jupyter_hub_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='jupyter_hub_management.JupyterHubManagement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='JupyterHubManagementMakeVirtualEnvironmentLocalRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('virtual_env_name', models.CharField(max_length=255)),
                ('output', models.TextField(blank=True)),
                ('jupyter_hub_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='jupyter_hub_management.JupyterHubManagement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='JupyterHubManagementSyncConfigurationRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('output', models.TextField(blank=True)),
                ('jupyter_hub_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='jupyter_hub_management.JupyterHubManagement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='JupyterHubOAuthConfig',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('type', models.PositiveSmallIntegerField(choices=[(1, 'GitLab'), (2, 'Microsoft Azure')])),
                ('oauth_callback_url', models.CharField(max_length=255)),
                ('client_id', models.CharField(max_length=255)),
                ('client_secret', models.CharField(max_length=255)),
                ('tenant_id', models.CharField(blank=True, max_length=255, null=True)),
                ('gitlab_host', models.CharField(blank=True, max_length=255, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='JupyterHubUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('admin', models.BooleanField(default=False)),
                ('whitelisted', models.BooleanField(default=False)),
                ('username', models.CharField(max_length=255)),
                ('password', models.CharField(blank=True, max_length=255, null=True)),
                ('jupyter_hub_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='jupyter_hub_users', to='jupyter_hub_management.JupyterHubManagement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='jupyterhubmanagementmakevirtualenvironmentglobalrequest',
            name='update_configuration_request',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='make_virtual_env_global_requests', to='jupyter_hub_management.JupyterHubManagementSyncConfigurationRequest'),
        ),
        migrations.AddField(
            model_name='jupyterhubmanagement',
            name='jupyter_hub_oauth_config',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='jupyter_hub_management.JupyterHubOAuthConfig'),
        ),
        migrations.AddField(
            model_name='jupyterhubmanagement',
            name='project',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.Project'),
        ),
        migrations.AddField(
            model_name='jupyterhubmanagement',
            name='python_management',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement'),
        ),
        migrations.AddField(
            model_name='jupyterhubmanagement',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='jupyterhubmanagement',
            unique_together=set([('instance_content_type', 'instance_object_id')]),
        ),
    ]
