# Generated by Django 5.2 on 2025-10-23 19:37

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0169_seed_platform_mcp_servers'),
    ]

    operations = [
        migrations.CreateModel(
            name='EmbeddingsModelEndpoint',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('key', models.SlugField(help_text="Endpoint key, e.g., 'openai_text_embed_small'", max_length=96, unique=True)),
                ('enabled', models.BooleanField(default=True)),
                ('litellm_model', models.CharField(help_text='Model identifier passed to LiteLLM for embeddings.', 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='embedding_endpoints', to='api.llmprovider')),
            ],
            options={
                'ordering': ['provider__display_name', 'litellm_model'],
            },
        ),
        migrations.CreateModel(
            name='EmbeddingsLLMTier',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(help_text='1-based order across all embedding 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='EmbeddingsTierEndpoint',
            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.embeddingsmodelendpoint')),
                ('tier', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tier_endpoints', to='api.embeddingsllmtier')),
            ],
            options={
                'ordering': ['tier__order', 'endpoint__key'],
                'unique_together': {('tier', 'endpoint')},
            },
        ),
        migrations.AddIndex(
            model_name='embeddingsmodelendpoint',
            index=models.Index(fields=['key'], name='api_embeddi_key_d52663_idx'),
        ),
        migrations.AddIndex(
            model_name='embeddingsmodelendpoint',
            index=models.Index(fields=['enabled'], name='api_embeddi_enabled_609044_idx'),
        ),
        migrations.AddIndex(
            model_name='embeddingsmodelendpoint',
            index=models.Index(fields=['provider'], name='api_embeddi_provide_5d0738_idx'),
        ),
    ]
