# Generated by Django 3.0 on 2019-12-24 14:59

from decimal import Decimal
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        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)),
                ('code', models.CharField(max_length=10, unique=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Stock',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('value', models.DecimalField(decimal_places=5, default=0, max_digits=100, validators=[django.core.validators.MinValueValidator(Decimal('0'))])),
                ('is_active', models.BooleanField(default=True)),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='stocks.Currency')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('user', 'currency')},
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('value', models.DecimalField(decimal_places=5, default=0, max_digits=100, validators=[django.core.validators.MinValueValidator(Decimal('0'))])),
                ('type', models.CharField(choices=[('CMN', 'Common'), ('EXC', 'Exchange'), ('CMS', 'Commission'), ('CNL', 'Canceled'), ('RVK', 'Revoke')], default='CMN', max_length=3)),
                ('related_transaction', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='stocks.Transaction')),
                ('stock_from', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='stocks.Stock')),
                ('stock_to', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='stocks.Stock')),
            ],
        ),
    ]
