# Generated by Django 5.2 on 2025-09-15 00:40

from django.db import migrations, models

from ._helpers import SafeAddIndex, SafeRemoveConstraint


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0123_merge_20250914_1909'),
    ]

    operations = [
        SafeRemoveConstraint(
            model_name='browserllmtier',
            name='uniq_browser_tier_order_per_policy',
        ),
        SafeRemoveConstraint(
            model_name='browsertierendpoint',
            name='uniq_browser_endpoint_per_tier',
        ),
        SafeRemoveConstraint(
            model_name='persistentllmtier',
            name='uniq_persistent_tier_order_per_range',
        ),
        SafeRemoveConstraint(
            model_name='persistenttierendpoint',
            name='uniq_persistent_endpoint_per_tier',
        ),
        migrations.AlterField(
            model_name='browsermodelendpoint',
            name='browser_base_url',
            field=models.CharField(blank=True, help_text='Base URL for OpenAI-compatible providers (optional)', max_length=256),
        ),
        migrations.AlterField(
            model_name='browsermodelendpoint',
            name='key',
            field=models.SlugField(help_text="Endpoint key, e.g., 'openrouter_glm_45'", max_length=96, unique=True),
        ),
        migrations.AlterField(
            model_name='llmprovider',
            name='api_key_encrypted',
            field=models.BinaryField(blank=True, help_text='AES-256-GCM encrypted API key (optional)', null=True),
        ),
        migrations.AlterField(
            model_name='llmprovider',
            name='browser_backend',
            field=models.CharField(choices=[('OPENAI', 'OpenAI'), ('ANTHROPIC', 'Anthropic'), ('GOOGLE', 'Google'), ('OPENAI_COMPAT', 'OpenAI-Compatible')], default='OPENAI', help_text='Browser client backend to use for this provider', max_length=16),
        ),
        migrations.AlterField(
            model_name='llmprovider',
            name='env_var_name',
            field=models.CharField(blank=True, help_text='Environment variable fallback for API key', max_length=128),
        ),
        migrations.AlterField(
            model_name='llmprovider',
            name='key',
            field=models.SlugField(help_text="Provider key, e.g., 'openai', 'anthropic'", max_length=64, unique=True),
        ),
        migrations.AlterField(
            model_name='persistentmodelendpoint',
            name='key',
            field=models.SlugField(help_text="Endpoint key, e.g., 'openai_gpt5'", max_length=96, unique=True),
        ),
        migrations.AlterField(
            model_name='persistenttokenrange',
            name='max_tokens',
            field=models.PositiveIntegerField(blank=True, help_text='Exclusive upper bound; null means infinity', null=True),
        ),
        migrations.AlterUniqueTogether(
            name='browserllmtier',
            unique_together={('policy', 'order')},
        ),
        migrations.AlterUniqueTogether(
            name='browsertierendpoint',
            unique_together={('tier', 'endpoint')},
        ),
        migrations.AlterUniqueTogether(
            name='persistentllmtier',
            unique_together={('token_range', 'order')},
        ),
        migrations.AlterUniqueTogether(
            name='persistenttierendpoint',
            unique_together={('tier', 'endpoint')},
        ),
        SafeAddIndex(
            model_name='browsermodelendpoint',
            index=models.Index(fields=['key'], name='api_browser_key_241b29_idx'),
        ),
        SafeAddIndex(
            model_name='browsermodelendpoint',
            index=models.Index(fields=['enabled'], name='api_browser_enabled_a7c777_idx'),
        ),
        SafeAddIndex(
            model_name='browsermodelendpoint',
            index=models.Index(fields=['provider'], name='api_browser_provide_4675f8_idx'),
        ),
        SafeAddIndex(
            model_name='llmprovider',
            index=models.Index(fields=['key'], name='api_llmprov_key_2c3b10_idx'),
        ),
        SafeAddIndex(
            model_name='llmprovider',
            index=models.Index(fields=['enabled'], name='api_llmprov_enabled_5c6260_idx'),
        ),
        SafeAddIndex(
            model_name='persistentmodelendpoint',
            index=models.Index(fields=['key'], name='api_persist_key_c20ecf_idx'),
        ),
        SafeAddIndex(
            model_name='persistentmodelendpoint',
            index=models.Index(fields=['enabled'], name='api_persist_enabled_13251a_idx'),
        ),
        SafeAddIndex(
            model_name='persistentmodelendpoint',
            index=models.Index(fields=['provider'], name='api_persist_provide_cf7c97_idx'),
        ),
        SafeAddIndex(
            model_name='persistenttokenrange',
            index=models.Index(fields=['min_tokens', 'max_tokens'], name='api_persist_min_tok_644cd1_idx'),
        ),
    ]
