# Generated by Django 3.2.7 on 2021-09-30 15:43

from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import finance.models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Budget',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Start of the budget')),
                ('end', models.DateTimeField(default=finance.models._default_end, verbose_name='End of the budget')),
                ('balance', models.DecimalField(decimal_places=2, default=Decimal('0'), max_digits=10)),
                ('start_balance', models.DecimalField(decimal_places=2, default=Decimal('0'), max_digits=10)),
            ],
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Created timestamp')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('budget', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='finance.budget', verbose_name='Transaction in the budget')),
            ],
        ),
        migrations.CreateModel(
            name='TransactionCategory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField(verbose_name='Name of category')),
                ('code', models.CharField(max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='TransactionThroughCategory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateField(default=django.utils.timezone.now)),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.transactioncategory')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.transaction')),
            ],
        ),
        migrations.AddField(
            model_name='transaction',
            name='categories',
            field=models.ManyToManyField(to='finance.TransactionCategory'),
        ),
        migrations.CreateModel(
            name='FinanceAccount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
                ('type', models.CharField(choices=[('P', 'Private'), ('B', 'Business')], max_length=1)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accounts', to=settings.AUTH_USER_MODEL, verbose_name='User personal account')),
            ],
        ),
        migrations.AddField(
            model_name='budget',
            name='account',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='budgets', to='finance.financeaccount', verbose_name='User personal account'),
        ),
    ]
