# Generated by Django 5.2.8 on 2025-12-06 15:03

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="RateLimit",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("name", models.CharField(blank=True, default="", max_length=128)),
                (
                    "scope_key",
                    models.CharField(
                        default="default",
                        help_text="Namespace used to differentiate rate limit scopes.",
                        max_length=64,
                    ),
                ),
                (
                    "limit",
                    models.PositiveIntegerField(
                        help_text="Maximum allowed attempts within the configured window."
                    ),
                ),
                (
                    "window_seconds",
                    models.PositiveIntegerField(
                        help_text="Rolling window in seconds for the rate limit."
                    ),
                ),
                ("enabled", models.BooleanField(default=True)),
                (
                    "target_object_id",
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.contenttype",
                    ),
                ),
            ],
            options={
                "verbose_name": "Rate limit",
                "verbose_name_plural": "Rate limits",
                "unique_together": {("content_type", "scope_key")},
            },
        ),
    ]
