# Generated by Django 3.1.2 on 2020-10-09 18:39

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='AccountBalance',
            fields=[
                ('address', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False, unique=True)),
                ('amount', models.DecimalField(decimal_places=18, default=0, max_digits=34)),
            ],
        ),
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('symbol', models.CharField(max_length=5)),
            ],
        ),
        migrations.CreateModel(
            name='Wallet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_operative', models.BooleanField(default=True)),
                ('owner', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='wallet', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('owner', 'id')},
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=18, default=0, max_digits=34)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('sent_from', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transactions_sent', to='wallet.accountbalance')),
                ('sent_to', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transactions_received', to='wallet.accountbalance')),
            ],
        ),
        migrations.AddField(
            model_name='accountbalance',
            name='currency',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wallet.currency'),
        ),
        migrations.AddField(
            model_name='accountbalance',
            name='wallet',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='balances', to='wallet.wallet'),
        ),
        migrations.AlterUniqueTogether(
            name='accountbalance',
            unique_together={('wallet', 'currency')},
        ),
    ]
