from django.conf import settings
from django.db import migrations, models
from django.utils import timezone


class Migration(migrations.Migration):

    dependencies = [
        ("shop_management", "0064_backfill_purchaseitem_currency"),
    ]

    operations = [
        migrations.CreateModel(
            name="PassiveIncome",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True, blank=True)),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, blank=True)),
                ("name", models.CharField(max_length=255)),
                ("amount", models.DecimalField(max_digits=12, decimal_places=2)),
                ("exchange_rate", models.DecimalField(default=1, max_digits=20, decimal_places=6)),
                ("converted_amount", models.DecimalField(default=0, max_digits=18, decimal_places=2)),
                ("income_date", models.DateTimeField(default=timezone.now)),
                ("notes", models.TextField(blank=True, null=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.SET_NULL,
                        related_name="passiveincome_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "account",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.SET_NULL,
                        related_name="passive_incomes",
                        to="shop_management.account",
                    ),
                ),
                (
                    "currency",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.SET_NULL,
                        related_name="passive_incomes",
                        to="shop_management.currency",
                    ),
                ),
                (
                    "shop",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=models.CASCADE,
                        related_name="passive_incomes",
                        to="shop_management.shop",
                    ),
                ),
            ],
        ),
    ]
