# Generated by Django 2.0 on 2019-01-16 15:18

import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django_orion_model.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ContextBroker',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True)),
                ('url', models.URLField()),
                ('oauth_enable', models.BooleanField(default=False)),
                ('oauth_url', models.URLField(blank=True)),
                ('oauth_user', models.CharField(blank=True, max_length=50)),
                ('oauth_password', models.CharField(blank=True, max_length=50)),
                ('oauth_client_id', models.CharField(blank=True, max_length=50)),
                ('oauth_client_secret', models.CharField(blank=True, max_length=50)),
                ('oauth_access_token', models.CharField(blank=True, max_length=50)),
                ('oauth_refresh_token', models.CharField(blank=True, max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='OrionEntity',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('orion_id', models.CharField(max_length=1011, unique=True)),
                ('orion_type', models.CharField(max_length=1011)),
                ('orion_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict)),
                ('orion_updated', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, default=list, size=None)),
                ('orion_expiration', models.DateTimeField(blank=True, default=django_orion_model.models._expire_time)),
                ('orion_status', models.CharField(blank=True, choices=[('CREATING', 'Creating'), ('CREATED', 'Created'), ('WRITING', 'Pending writing'), ('READING', 'Pending reading'), ('OK', 'Ok'), ('REFRESH', 'Await refresh'), ('REWRITING', 'Await rewrite'), ('OFFLINE', 'Offline'), ('MISSING', 'Missing')], default='created', max_length=50)),
                ('orion_error', models.TextField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True)),
                ('path', models.CharField(max_length=65000)),
                ('context_broker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_orion_model.ContextBroker')),
            ],
        ),
        migrations.CreateModel(
            name='ServicePath',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True)),
                ('path', models.CharField(max_length=65000)),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_orion_model.Service')),
            ],
        ),
        migrations.AddField(
            model_name='orionentity',
            name='orion_service_path',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_orion_model.ServicePath'),
        ),
    ]
