# Generated by Django 6.0 on 2026-05-03 16:24

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0365_persistent_agent_completion_helper_types'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserFlagChoiceGroup',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(help_text="Stable identifier for this admin select group, for example 'churn_type'.", max_length=64, unique=True)),
                ('label', models.CharField(help_text="Label shown on the user admin form, for example 'Churn Type'.", max_length=120)),
                ('description', models.TextField(blank=True, help_text='Optional explanation shown as help text on the user admin form.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'User flag choice group',
                'verbose_name_plural': 'User flag choice groups',
                'ordering': ('label', 'slug'),
            },
        ),
        migrations.CreateModel(
            name='UserFlagChoiceOption',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(help_text='Label shown in the user admin select list.', max_length=160)),
                ('is_active', models.BooleanField(db_index=True, default=True, help_text='Inactive options remain assigned where already used but are hidden for new selections.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('flag', models.ForeignKey(help_text='Concrete flag enabled when this option is selected.', on_delete=django.db.models.deletion.PROTECT, related_name='choice_options', to='api.userflagdefinition')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='options', to='api.userflagchoicegroup')),
            ],
            options={
                'verbose_name': 'User flag choice option',
                'verbose_name_plural': 'User flag choice options',
                'ordering': ('label', 'id'),
                'constraints': [models.UniqueConstraint(fields=('group', 'label'), name='unique_user_flag_choice_group_label'), models.UniqueConstraint(fields=('group', 'flag'), name='unique_user_flag_choice_group_flag'), models.UniqueConstraint(fields=('flag',), name='unique_user_flag_choice_option_flag')],
            },
        ),
    ]
