# Generated by Django 3.2 on 2021-05-08 11:12

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

from wikiazma.storage_helper import public_storage


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('authenticate', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='APIKey',
            fields=[
                ('id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('api_key', models.CharField(db_index=True, max_length=460)),
                ('roles', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), db_index=True, default=list, size=None)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified_at', models.DateTimeField(auto_now=True, db_index=True)),
                ('expire_at', models.DateTimeField(blank=True, db_index=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Institute',
            fields=[
                ('id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('name', models.CharField(db_index=True, max_length=100)),
                ('description', models.TextField(blank=True, max_length=3000, null=True)),
                ('unique_name', models.CharField(db_index=True, max_length=355, unique=True)),
                ('logo', models.ImageField(storage=public_storage, upload_to='institute/logo')),
                ('redirect_url', models.CharField(max_length=100)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified_at', models.DateTimeField(auto_now=True, db_index=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='authenticate.user')),
            ],
        ),
        migrations.CreateModel(
            name='TransferOwnershipHistory',
            fields=[
                ('id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('description', models.TextField(blank=True, max_length=3000, null=True)),
                ('new_owner_accept_key', models.CharField(blank=True, max_length=64, null=True, unique=True)),
                ('old_owner_accept_key', models.CharField(blank=True, max_length=64, null=True, unique=True)),
                ('new_owner_accept_at', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('old_owner_accept_at', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified_at', models.DateTimeField(auto_now=True, db_index=True)),
                ('institute', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='institute.institute')),
                ('new_owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='new_owner', to='authenticate.user')),
                ('old_owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='old_owner', to='authenticate.user')),
            ],
        ),
        migrations.CreateModel(
            name='InstituteJWT',
            fields=[
                ('id', models.BigAutoField(db_index=True, primary_key=True, serialize=False, unique=True)),
                ('token', models.CharField(db_index=True, max_length=460, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified_at', models.DateTimeField(auto_now=True, db_index=True)),
                ('expire_at', models.DateTimeField()),
                ('api_key', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='institute.apikey')),
            ],
        ),
        migrations.AddField(
            model_name='apikey',
            name='institute',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='institute.institute'),
        ),
    ]
