# Generated by Django 4.2.7 on 2026-01-01 23:09

import django.db.models.deletion
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),
    ]

    operations = [
        migrations.CreateModel(
            name="Project",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("name", models.CharField(max_length=25)),
                ("description", models.TextField(blank=True, null=True)),
                ("status", models.CharField(blank=True, max_length=25, null=True)),
                ("discipline", models.CharField(blank=True, max_length=50, null=True)),
                (
                    "num_child_projects_recursive",
                    models.IntegerField(blank=True, null=True),
                ),
                ("is_top_level", models.BooleanField(blank=True, null=True)),
                (
                    "leaders",
                    models.ManyToManyField(
                        related_name="projects_as_leader", to=settings.AUTH_USER_MODEL
                    ),
                ),
                (
                    "members",
                    models.ManyToManyField(
                        related_name="projects_as_member", to=settings.AUTH_USER_MODEL
                    ),
                ),
                (
                    "parent_project",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="child_projects",
                        to="project_management.project",
                    ),
                ),
            ],
            options={
                "db_table": "project_management__projects",
            },
        ),
        migrations.CreateModel(
            name="Wallet",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("wallet_type", models.CharField(blank=True, max_length=30, null=True)),
                (
                    "usdc_balance",
                    models.DecimalField(decimal_places=6, default=0, max_digits=30),
                ),
                (
                    "token_balance",
                    models.DecimalField(decimal_places=6, default=0, max_digits=30),
                ),
                (
                    "collateral_balance",
                    models.DecimalField(decimal_places=6, default=0, max_digits=30),
                ),
                (
                    "project",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="wallet",
                        to="project_management.project",
                    ),
                ),
                (
                    "user",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="wallet",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "db_table": "project_management__wallets",
            },
        ),
        migrations.CreateModel(
            name="Transaction",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("source", models.JSONField(blank=True, null=True)),
                ("status", models.CharField(blank=True, max_length=30, null=True)),
                (
                    "transaction_type",
                    models.CharField(blank=True, max_length=30, null=True),
                ),
                (
                    "transaction_subtype",
                    models.CharField(blank=True, max_length=30, null=True),
                ),
                (
                    "usdc_amount",
                    models.DecimalField(decimal_places=6, default=0, max_digits=30),
                ),
                (
                    "token_amount",
                    models.DecimalField(decimal_places=6, default=0, max_digits=30),
                ),
                (
                    "collateral_amount",
                    models.DecimalField(decimal_places=6, default=0, max_digits=30),
                ),
                ("comments", models.TextField(blank=True, null=True)),
                (
                    "from_wallet",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transactions_out",
                        to="project_management.wallet",
                    ),
                ),
                (
                    "sending_user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transactions_sent",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "to_wallet",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transactions_in",
                        to="project_management.wallet",
                    ),
                ),
            ],
            options={
                "db_table": "project_management__transactions",
            },
        ),
        migrations.CreateModel(
            name="Tag",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("tag_type", models.CharField(blank=True, max_length=30, null=True)),
                ("name", models.CharField(blank=True, max_length=30, null=True)),
                ("description", models.TextField(blank=True, null=True)),
                (
                    "project",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="tags",
                        to="project_management.project",
                    ),
                ),
            ],
            options={
                "db_table": "project_management__tags",
            },
        ),
    ]
