# Generated by Django 5.2.14 on 2026-06-26 21:43

import django.db.models.deletion
import opencontractserver.shared.user_can_mixin
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        (
            "corpuses",
            "0057_rename_corpuses_co_corpus__vote_idx_corpuses_co_corpus__64f0b6_idx_and_more",
        ),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Artifact",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("backend_lock", models.BooleanField(db_index=True, default=False)),
                ("is_public", models.BooleanField(default=False)),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                ("template", models.CharField(max_length=64)),
                ("title", models.CharField(blank=True, default="", max_length=255)),
                ("subtitle", models.TextField(blank=True, default="")),
                ("byline", models.CharField(blank=True, default="", max_length=255)),
                ("config", models.JSONField(blank=True, default=dict)),
                (
                    "slug",
                    models.CharField(
                        blank=True, db_index=True, max_length=128, unique=True
                    ),
                ),
                (
                    "image",
                    models.FileField(
                        blank=True, null=True, upload_to="artifact_images/"
                    ),
                ),
                (
                    "corpus",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="artifacts",
                        to="corpuses.corpus",
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user_lock",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="locked_%(class)s_objects",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "indexes": [
                    models.Index(
                        fields=["corpus"], name="corpuses_ar_corpus__364699_idx"
                    ),
                    models.Index(fields=["slug"], name="corpuses_ar_slug_cb67a9_idx"),
                ],
            },
            bases=(
                opencontractserver.shared.user_can_mixin.InstanceUserCanMixin,
                models.Model,
            ),
        ),
    ]
