# Generated by Django 2.2.9 on 2020-01-30 14:22

from django.conf import settings
import django.contrib.sites.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import hub20.apps.blockchain.fields
import hub20.apps.core.models.payments
import hub20.apps.ethereum_money.models
import model_utils.fields
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('blockchain', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('raiden', '0001_initial'),
        ('ethereum_money', '0001_initial'),
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', hub20.apps.ethereum_money.models.EthereumTokenAmountField(decimal_places=18, max_digits=32)),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='ethereum_money.EthereumToken')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Store',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=300)),
                ('url', models.URLField()),
                ('accepted_currencies', models.ManyToManyField(to='ethereum_money.EthereumToken')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Transfer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', hub20.apps.ethereum_money.models.EthereumTokenAmountField(decimal_places=18, max_digits=32)),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('memo', models.TextField(blank=True, null=True)),
                ('identifier', models.CharField(blank=True, max_length=300, null=True)),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='ethereum_money.EthereumToken')),
                ('sender', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transfers_sent', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserReserve',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', hub20.apps.ethereum_money.models.EthereumTokenAmountField(decimal_places=18, max_digits=32)),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='ethereum_money.EthereumToken')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reserves', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='HubSite',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('sites.site',),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.CreateModel(
            name='ExternalTransfer',
            fields=[
                ('transfer_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Transfer')),
                ('recipient_address', hub20.apps.blockchain.fields.EthereumAddressField(db_index=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('core.transfer',),
        ),
        migrations.CreateModel(
            name='Wallet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('account', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='ethereum_money.EthereumAccount')),
            ],
        ),
        migrations.CreateModel(
            name='UserBalanceEntry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', hub20.apps.ethereum_money.models.EthereumTokenAmountField(decimal_places=18, max_digits=32)),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='ethereum_money.EthereumToken')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='balance_entries', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='StoreRSAKeyPair',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('public_key_pem', models.TextField()),
                ('private_key_pem', models.TextField()),
                ('store', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='rsa', to='core.Store')),
            ],
        ),
        migrations.CreateModel(
            name='PaymentOrderMethod',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('expiration_time', models.DateTimeField()),
                ('identifier', models.BigIntegerField(default=hub20.apps.core.models.payments.generate_payment_order_id, unique=True)),
                ('order', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payment_method', to='core.PaymentOrder')),
                ('raiden', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='raiden.Raiden')),
                ('wallet', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='core.Wallet')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', hub20.apps.ethereum_money.models.EthereumTokenAmountField(decimal_places=18, max_digits=32)),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='ethereum_money.EthereumToken')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.PaymentOrder')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Checkout',
            fields=[
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('external_identifier', models.TextField()),
                ('requester_ip', models.GenericIPAddressField(null=True)),
                ('payment_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.PaymentOrder')),
                ('store', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Store')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BlockchainTransaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('transaction_hash', hub20.apps.blockchain.fields.HexField(db_index=True, max_length=64, unique=True)),
                ('transfer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='chain_transaction', to='core.Transfer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserTransferReserve',
            fields=[
                ('userreserve_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.UserReserve')),
                ('transfer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='reserve', to='core.Transfer')),
            ],
            options={
                'abstract': False,
            },
            bases=('core.userreserve',),
        ),
        migrations.CreateModel(
            name='TransferEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('status', model_utils.fields.StatusField(choices=[('scheduled', 'scheduled'), ('failed', 'failed'), ('canceled', 'canceled'), ('executed', 'executed'), ('confirmed', 'confirmed')], default='scheduled', max_length=100, no_check_for_status=True, verbose_name='status')),
                ('status_changed', model_utils.fields.MonitorField(default=django.utils.timezone.now, monitor='status', verbose_name='status changed')),
                ('transfer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='events', to='core.Transfer')),
            ],
            options={
                'get_latest_by': 'created',
                'unique_together': {('transfer', 'status')},
            },
        ),
        migrations.CreateModel(
            name='RaidenTransaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('identifier', models.PositiveIntegerField()),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='raiden.Channel')),
                ('transfer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='raiden_transaction', to='core.Transfer')),
            ],
            options={
                'unique_together': {('channel', 'identifier')},
            },
        ),
        migrations.CreateModel(
            name='RaidenPayment',
            fields=[
                ('payment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Payment')),
                ('payment', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='raiden.Payment')),
            ],
            options={
                'abstract': False,
            },
            bases=('core.payment',),
        ),
        migrations.CreateModel(
            name='PaymentOrderEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('status', model_utils.fields.StatusField(choices=[('requested', 'requested'), ('partial', 'partial'), ('received', 'received'), ('confirmed', 'confirmed'), ('expired', 'expired'), ('canceled', 'canceled'), ('voided', 'voided')], default='requested', max_length=100, no_check_for_status=True, verbose_name='status')),
                ('status_changed', model_utils.fields.MonitorField(default=django.utils.timezone.now, monitor='status', verbose_name='status changed')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='events', to='core.PaymentOrder')),
            ],
            options={
                'get_latest_by': 'created',
                'unique_together': {('order', 'status')},
            },
        ),
        migrations.CreateModel(
            name='InternalTransfer',
            fields=[
                ('transfer_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Transfer')),
                ('receiver', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transfers_received', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
            bases=('core.transfer',),
        ),
        migrations.CreateModel(
            name='InternalPayment',
            fields=[
                ('payment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Payment')),
                ('memo', models.TextField(blank=True, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
            bases=('core.payment',),
        ),
        migrations.CreateModel(
            name='BlockchainPayment',
            fields=[
                ('payment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Payment')),
                ('transaction', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='blockchain.Transaction')),
            ],
            options={
                'abstract': False,
            },
            bases=('core.payment',),
        ),
    ]
