# Generated by Django 4.2.21 on 2025-06-02 21:09

# Django
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="IndustryJob",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("character_id", models.BigIntegerField()),
                ("job_id", models.IntegerField(unique=True)),
                ("installer_id", models.IntegerField()),
                ("facility_id", models.BigIntegerField()),
                ("station_id", models.BigIntegerField(blank=True, null=True)),
                ("activity_id", models.IntegerField()),
                ("blueprint_id", models.BigIntegerField()),
                ("blueprint_type_id", models.IntegerField()),
                ("blueprint_location_id", models.BigIntegerField()),
                ("output_location_id", models.BigIntegerField()),
                ("runs", models.IntegerField()),
                (
                    "cost",
                    models.DecimalField(
                        blank=True, decimal_places=2, max_digits=20, null=True
                    ),
                ),
                ("licensed_runs", models.IntegerField(blank=True, null=True)),
                ("probability", models.FloatField(blank=True, null=True)),
                ("product_type_id", models.IntegerField(blank=True, null=True)),
                ("status", models.CharField(max_length=20)),
                ("duration", models.IntegerField()),
                ("start_date", models.DateTimeField()),
                ("end_date", models.DateTimeField()),
                ("pause_date", models.DateTimeField(blank=True, null=True)),
                ("completed_date", models.DateTimeField(blank=True, null=True)),
                ("completed_character_id", models.IntegerField(blank=True, null=True)),
                ("successful_runs", models.IntegerField(blank=True, null=True)),
                ("blueprint_type_name", models.CharField(blank=True, max_length=255)),
                ("product_type_name", models.CharField(blank=True, max_length=255)),
                ("activity_name", models.CharField(blank=True, max_length=100)),
                ("last_updated", models.DateTimeField(auto_now=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "owner_user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="industry_jobs",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Industry Job",
                "verbose_name_plural": "Industry Jobs",
                "indexes": [
                    models.Index(
                        fields=["character_id", "status"],
                        name="indy_hub_in_charact_9ec4da_idx",
                    ),
                    models.Index(
                        fields=["owner_user", "start_date"],
                        name="indy_hub_in_owner_u_b59db7_idx",
                    ),
                    models.Index(
                        fields=["activity_id", "status"],
                        name="indy_hub_in_activit_8408d4_idx",
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="CharacterUpdateTracker",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("character_id", models.BigIntegerField()),
                ("blueprints_last_update", models.DateTimeField(blank=True, null=True)),
                ("jobs_last_update", models.DateTimeField(blank=True, null=True)),
                ("last_error", models.TextField(blank=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Character Update Tracker",
                "verbose_name_plural": "Character Update Trackers",
                "unique_together": {("user", "character_id")},
            },
        ),
        migrations.CreateModel(
            name="Blueprint",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("character_id", models.BigIntegerField()),
                ("item_id", models.BigIntegerField(unique=True)),
                ("type_id", models.IntegerField()),
                ("location_id", models.BigIntegerField()),
                ("location_flag", models.CharField(max_length=50)),
                ("quantity", models.IntegerField(default=1)),
                ("time_efficiency", models.IntegerField(default=0)),
                ("material_efficiency", models.IntegerField(default=0)),
                ("runs", models.IntegerField(default=0)),
                ("type_name", models.CharField(blank=True, max_length=255)),
                ("last_updated", models.DateTimeField(auto_now=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "owner_user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="blueprints",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Blueprint",
                "verbose_name_plural": "Blueprints",
                "indexes": [
                    models.Index(
                        fields=["character_id", "type_id"],
                        name="indy_hub_bl_charact_bfe16f_idx",
                    ),
                    models.Index(
                        fields=["owner_user", "last_updated"],
                        name="indy_hub_bl_owner_u_47cf92_idx",
                    ),
                ],
            },
        ),
    ]
