# Generated by Django 5.2 on 2026-01-20 01:08

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0261_pipedreamconnectsession_nullable_connect_token'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='persistentagenttemplate',
            name='created_by',
            field=models.ForeignKey(blank=True, help_text='User who created this template, if applicable.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_templates', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='persistentagenttemplate',
            name='slug',
            field=models.SlugField(blank=True, help_text='Public-facing slug used in template URLs.', max_length=80),
        ),
        migrations.AddField(
            model_name='persistentagenttemplate',
            name='source_agent',
            field=models.ForeignKey(blank=True, help_text='Agent this template was cloned from, when applicable.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='generated_templates', to='api.persistentagent'),
        ),
        migrations.CreateModel(
            name='PublicProfile',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('handle', models.SlugField(help_text='Public profile handle (lowercase letters, numbers, and hyphens).', max_length=32, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='public_profile', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['handle'],
            },
        ),
        migrations.AddField(
            model_name='persistentagenttemplate',
            name='public_profile',
            field=models.ForeignKey(blank=True, help_text='Public profile that owns this template when shared publicly.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='templates', to='api.publicprofile'),
        ),
        migrations.AddConstraint(
            model_name='persistentagenttemplate',
            constraint=models.UniqueConstraint(condition=models.Q(('public_profile__isnull', False)), fields=('public_profile', 'slug'), name='unique_public_profile_template_slug'),
        ),
    ]
