# Generated by Django 2.2.11 on 2020-03-22 11:36

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('identifier', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('account_id', models.CharField(max_length=50)),
                ('name', models.CharField(max_length=100)),
                ('official_name', models.CharField(blank=True, max_length=200, null=True)),
                ('type', models.CharField(max_length=30)),
                ('subtype', models.CharField(max_length=30)),
                ('verification_status', models.CharField(max_length=50)),
                ('mask', models.CharField(blank=True, max_length=10, null=True)),
            ],
            options={
                'verbose_name': 'Plaid Account',
                'verbose_name_plural': 'Plaid Accounts',
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('transaction_id', models.CharField(max_length=50)),
                ('category_id', models.CharField(max_length=25)),
                ('transaction_type', models.CharField(max_length=25)),
                ('name', models.CharField(max_length=200)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('iso_currency_code', models.CharField(max_length=10)),
                ('unofficial_currency_code', models.CharField(blank=True, max_length=20, null=True)),
                ('date', models.DateField()),
                ('authorized_date', models.DateField(blank=True, null=True)),
                ('payment_channel', models.CharField(max_length=50)),
                ('pending', models.BooleanField()),
                ('pending_transaction_id', models.CharField(blank=True, max_length=50, null=True)),
                ('account_owner', models.CharField(blank=True, max_length=100, null=True)),
                ('transaction_code', models.CharField(blank=True, max_length=50, null=True)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plaidapp.Account')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Transaction',
                'verbose_name_plural': 'Transactions',
                'ordering': ['-date', '-created'],
            },
        ),
        migrations.CreateModel(
            name='PlaidItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('identifier', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('access_token', models.CharField(max_length=200)),
                ('item_id', models.CharField(max_length=200)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Plaid Item',
                'verbose_name_plural': 'Plaid Items',
            },
        ),
        migrations.CreateModel(
            name='ItemMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('identifier', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('item_meta_id', models.CharField(max_length=100)),
                ('institution_id', models.CharField(max_length=100)),
                ('webhook', models.CharField(blank=True, max_length=256, null=True)),
                ('last_successful_update', models.DateTimeField(blank=True, null=True)),
                ('last_failed_update', models.DateTimeField(blank=True, null=True)),
                ('webhook_last_sent_at', models.DateTimeField(blank=True, null=True)),
                ('webhook_last_code_sent', models.CharField(blank=True, max_length=50, null=True)),
                ('billed_products', models.CharField(max_length=200)),
                ('available_products', models.CharField(max_length=200)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plaidapp.PlaidItem')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Item Metadata',
                'verbose_name_plural': 'Items Metadata',
            },
        ),
        migrations.CreateModel(
            name='Balance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('current', models.DecimalField(decimal_places=2, max_digits=18, verbose_name='Current amount')),
                ('available', models.DecimalField(blank=True, decimal_places=2, max_digits=18, null=True, verbose_name='Available amount')),
                ('limit', models.DecimalField(blank=True, decimal_places=2, max_digits=18, null=True, verbose_name='Limit')),
                ('iso_currency_code', models.CharField(max_length=10)),
                ('unofficial_currency_code', models.CharField(blank=True, max_length=20, null=True)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='balances', to='plaidapp.Account')),
            ],
            options={
                'verbose_name': 'Account Balance',
                'verbose_name_plural': 'Account Balances',
            },
        ),
        migrations.AddField(
            model_name='account',
            name='item',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plaidapp.PlaidItem'),
        ),
        migrations.AddField(
            model_name='account',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
    ]
