# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-11-11 04:11
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('credentials', '0002_auto_20171111_1209'),
    ]

    operations = [
        migrations.CreateModel(
            name='OAuthAccessToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('expire_at', models.DateTimeField()),
                ('access_token', models.CharField(max_length=40, unique=True)),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='credentials.OAuthClient')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OAuthAuthorizationCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('expire_at', models.DateTimeField()),
                ('code', models.CharField(max_length=40, unique=True)),
                ('redirect_uri', models.CharField(max_length=200, null=True)),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='credentials.OAuthClient')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OAuthRefreshToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('expire_at', models.DateTimeField()),
                ('refresh_token', models.CharField(max_length=40, unique=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OAuthScope',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('scope', models.CharField(max_length=200, unique=True)),
                ('description', models.TextField()),
                ('is_default', models.BooleanField(default=False)),
            ],
        ),
        migrations.AddField(
            model_name='oauthauthorizationcode',
            name='scopes',
            field=models.ManyToManyField(to='tokens.OAuthScope'),
        ),
        migrations.AddField(
            model_name='oauthauthorizationcode',
            name='user',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='credentials.OAuthUser'),
        ),
        migrations.AddField(
            model_name='oauthaccesstoken',
            name='refresh_token',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='access_token', to='tokens.OAuthRefreshToken'),
        ),
        migrations.AddField(
            model_name='oauthaccesstoken',
            name='scopes',
            field=models.ManyToManyField(to='tokens.OAuthScope'),
        ),
        migrations.AddField(
            model_name='oauthaccesstoken',
            name='user',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='credentials.OAuthUser'),
        ),
    ]
