# Generated by Django 6.0 on 2026-02-23 21:48

import django.db.models.deletion
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("api", "0292_agentspawnrequest_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="PersistentAgentSkill",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ("name", models.CharField(max_length=128)),
                ("description", models.TextField(blank=True)),
                ("version", models.PositiveIntegerField()),
                ("tools", models.JSONField(blank=True, default=list)),
                ("instructions", models.TextField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "agent",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="skills",
                        to="api.persistentagent",
                    ),
                ),
            ],
            options={
                "ordering": ["name", "-version", "-updated_at"],
            },
        ),
        migrations.AddIndex(
            model_name="persistentagentskill",
            index=models.Index(fields=["agent", "name", "-version"], name="pa_skill_agent_name_ver_idx"),
        ),
        migrations.AddIndex(
            model_name="persistentagentskill",
            index=models.Index(fields=["agent", "-updated_at"], name="pa_skill_agent_updated_idx"),
        ),
        migrations.AddConstraint(
            model_name="persistentagentskill",
            constraint=models.UniqueConstraint(fields=("agent", "name", "version"), name="unique_agent_skill_name_version"),
        ),
    ]
