# Generated by Django 4.1.4 on 2023-04-22 09:01

import datetime
import uuid

import django.core.validators
import django.db.models.deletion
import media.utils
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("main", "0002_segmentation"),
        ("account", "0001_initial"),
    ]

    state_operations = [
        migrations.CreateModel(
            name="Statement",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "date",
                    models.DateField(
                        default=datetime.date.today, verbose_name="End date"
                    ),
                ),
                (
                    "start_date",
                    models.DateField(
                        default=datetime.date.today, verbose_name="Start date"
                    ),
                ),
                (
                    "value",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=12,
                        verbose_name="End value",
                    ),
                ),
                (
                    "start_value",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=12,
                        verbose_name="Start value",
                    ),
                ),
                (
                    "diff",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        editable=False,
                        max_digits=12,
                        verbose_name="Difference",
                    ),
                ),
                (
                    "sum",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        editable=False,
                        max_digits=12,
                        verbose_name="Transaction difference",
                    ),
                ),
                (
                    "file",
                    models.FileField(
                        blank=True,
                        default="",
                        max_length=256,
                        upload_to=media.utils.get_path,
                        validators=[
                            django.core.validators.FileExtensionValidator(["pdf"])
                        ],
                        verbose_name="File",
                    ),
                ),
                (
                    "account",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="account.account",
                        verbose_name="Account",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        editable=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="User",
                    ),
                ),
            ],
            options={
                "verbose_name": "Statement",
                "verbose_name_plural": "Statements",
                "ordering": ["-date", "account"],
                "db_table": "statement_statement",
            },
        ),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(state_operations=state_operations)
    ]
