# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-05 21:05
from __future__ import unicode_literals

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

import waldur_core.core.fields
import waldur_core.core.validators


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ('openstack_tenant', '0030_add_volume_image_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CachedRepositoryPythonLibrary',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('name', models.CharField(db_index=True, max_length=255, validators=[waldur_core.core.validators.validate_name])),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='InstalledLibrary',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('version', models.CharField(max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PythonManagement',
            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()),
                ('virtual_envs_dir_path', models.CharField(max_length=255)),
                ('python_version', models.CharField(max_length=10)),
                ('instance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='openstack_tenant.Instance')),
                ('service_project_link', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='openstack_tenant.OpenStackTenantServiceProjectLink')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='PythonManagementDeleteRequest',
            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)),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PythonManagementDeleteVirtualEnvRequest',
            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)),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PythonManagementFindInstalledLibrariesRequest',
            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)),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PythonManagementFindVirtualEnvsRequest',
            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)),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PythonManagementInitializeRequest',
            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)),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PythonManagementSynchronizeRequest',
            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)),
                ('libraries_to_install', waldur_core.core.fields.JSONField(blank=True, default=[], help_text='List of libraries to install')),
                ('libraries_to_remove', waldur_core.core.fields.JSONField(blank=True, default=[], help_text='List of libraries to remove')),
                ('initialization_request', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sychronization_requests',
                                                             to='python_management.PythonManagementInitializeRequest')),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='VirtualEnvironment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('python_management', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='virtual_environments', to='python_management.PythonManagement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='installedlibrary',
            name='virtual_environment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='installed_libraries', to='python_management.VirtualEnvironment'),
        ),
        migrations.AlterUniqueTogether(
            name='pythonmanagement',
            unique_together=set([('instance', 'virtual_envs_dir_path')]),
        ),
    ]
