# Generated by Django 5.2 on 2026-02-05 22:59

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0280_add_tool_call_status'),
    ]

    operations = [
        migrations.CreateModel(
            name='ImageGenerationLLMTier',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(help_text='1-based order across all image generation tiers.', unique=True)),
                ('description', models.CharField(blank=True, max_length=256)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['order'],
            },
        ),
        migrations.CreateModel(
            name='ImageGenerationModelEndpoint',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('key', models.SlugField(help_text="Endpoint key, e.g., 'openrouter_flux_schnell'", max_length=96, unique=True)),
                ('enabled', models.BooleanField(default=True)),
                ('low_latency', models.BooleanField(default=False, help_text='Marks this endpoint as low latency/high performance.')),
                ('litellm_model', models.CharField(help_text='Model identifier passed to LiteLLM.', max_length=256)),
                ('api_base', models.CharField(blank=True, help_text='Optional OpenAI-compatible base URL for proxy endpoints.', max_length=256)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('provider', models.ForeignKey(blank=True, help_text='Optional link to the provider supplying credentials for this endpoint.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_generation_endpoints', to='api.llmprovider')),
            ],
            options={
                'ordering': ['provider__display_name', 'litellm_model'],
            },
        ),
        migrations.CreateModel(
            name='ImageGenerationTierEndpoint',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('weight', models.FloatField(help_text='Relative weight within the tier; must be > 0.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('endpoint', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='in_tiers', to='api.imagegenerationmodelendpoint')),
                ('tier', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tier_endpoints', to='api.imagegenerationllmtier')),
            ],
            options={
                'ordering': ['tier__order', 'endpoint__key'],
            },
        ),
        migrations.AddIndex(
            model_name='imagegenerationmodelendpoint',
            index=models.Index(fields=['key'], name='api_imagege_key_68657e_idx'),
        ),
        migrations.AddIndex(
            model_name='imagegenerationmodelendpoint',
            index=models.Index(fields=['enabled'], name='api_imagege_enabled_2b00ce_idx'),
        ),
        migrations.AddIndex(
            model_name='imagegenerationmodelendpoint',
            index=models.Index(fields=['provider'], name='api_imagege_provide_aef1b8_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='imagegenerationtierendpoint',
            unique_together={('tier', 'endpoint')},
        ),
    ]
