# Generated by Django 4.2.23 on 2025-12-27 11:26

# Django
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("indy_hub", "0045_materialexchangebuyorder_esi_contract_id_and_more"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="esi_contract_id",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="esi_contract_validated",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="esi_validation_checked_at",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="quantity",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="stock_available_at_creation",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="total_price",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="type_id",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="type_name",
        ),
        migrations.RemoveField(
            model_name="materialexchangebuyorder",
            name="unit_price",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="esi_contract_id",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="esi_contract_validated",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="esi_validation_checked_at",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="quantity",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="total_price",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="type_id",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="type_name",
        ),
        migrations.RemoveField(
            model_name="materialexchangesellorder",
            name="unit_price",
        ),
        migrations.CreateModel(
            name="MaterialExchangeSellOrderItem",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("type_id", models.IntegerField(help_text="Material type ID")),
                ("type_name", models.CharField(blank=True, max_length=255)),
                (
                    "quantity",
                    models.BigIntegerField(
                        validators=[django.core.validators.MinValueValidator(1)]
                    ),
                ),
                (
                    "unit_price",
                    models.DecimalField(
                        decimal_places=2,
                        help_text="Price per unit corp pays to member (Jita Buy + markup)",
                        max_digits=20,
                    ),
                ),
                ("total_price", models.DecimalField(decimal_places=2, max_digits=20)),
                (
                    "esi_contract_id",
                    models.BigIntegerField(
                        blank=True, help_text="ESI contract ID for this item", null=True
                    ),
                ),
                (
                    "esi_contract_validated",
                    models.BooleanField(
                        default=False,
                        help_text="Whether ESI validation confirmed this item in contract",
                    ),
                ),
                (
                    "esi_validation_checked_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="Last time ESI contract was validated for this item",
                        null=True,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="items",
                        to="indy_hub.materialexchangesellorder",
                    ),
                ),
            ],
            options={
                "verbose_name": "Material Exchange Sell Order Item",
                "verbose_name_plural": "Material Exchange Sell Order Items",
                "ordering": ["created_at"],
                "indexes": [
                    models.Index(
                        fields=["type_id"], name="indy_hub_ma_type_id_9b6b82_idx"
                    ),
                    models.Index(
                        fields=["order"], name="indy_hub_ma_order_i_158d3b_idx"
                    ),
                ],
            },
        ),
        migrations.CreateModel(
            name="MaterialExchangeBuyOrderItem",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("type_id", models.IntegerField(help_text="Material type ID")),
                ("type_name", models.CharField(blank=True, max_length=255)),
                (
                    "quantity",
                    models.BigIntegerField(
                        validators=[django.core.validators.MinValueValidator(1)]
                    ),
                ),
                (
                    "unit_price",
                    models.DecimalField(
                        decimal_places=2,
                        help_text="Price per unit member pays to corp (Jita Sell + markup)",
                        max_digits=20,
                    ),
                ),
                ("total_price", models.DecimalField(decimal_places=2, max_digits=20)),
                ("stock_available_at_creation", models.BigIntegerField(default=0)),
                (
                    "esi_contract_id",
                    models.BigIntegerField(
                        blank=True, help_text="ESI contract ID for this item", null=True
                    ),
                ),
                (
                    "esi_contract_validated",
                    models.BooleanField(
                        default=False,
                        help_text="Whether ESI validation confirmed this item in contract",
                    ),
                ),
                (
                    "esi_validation_checked_at",
                    models.DateTimeField(
                        blank=True,
                        help_text="Last time ESI contract was validated for this item",
                        null=True,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="items",
                        to="indy_hub.materialexchangebuyorder",
                    ),
                ),
            ],
            options={
                "verbose_name": "Material Exchange Buy Order Item",
                "verbose_name_plural": "Material Exchange Buy Order Items",
                "ordering": ["created_at"],
                "indexes": [
                    models.Index(
                        fields=["type_id"], name="indy_hub_ma_type_id_5e57fb_idx"
                    ),
                    models.Index(
                        fields=["order"], name="indy_hub_ma_order_i_5ccb01_idx"
                    ),
                ],
            },
        ),
    ]
