# Generated by Django 5.0.1 on 2024-01-26 20:42

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


class Migration(migrations.Migration):
    dependencies = [
        ("django_fast_iprestrict", "0006_rule_invert_methods_rule_methods_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="RuleRatelimitGroup",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        verbose_name="ratelimit group name",
                        help_text="matcher for django-fast-ratelimit group",
                        max_length=80,
                        validators=[django.core.validators.MinLengthValidator(1)],
                    ),
                ),
                ("is_active", models.BooleanField(blank=True, default=True)),
                (
                    "rule",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ratelimit_groups",
                        to="django_fast_iprestrict.rule",
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name="ruleratelimitgroup",
            constraint=models.UniqueConstraint(
                fields=("rule_id", "name"), name="rule_ratelimit_groups_unique"
            ),
        ),
    ]
