# Generated by Django 5.0.1 on 2024-02-09 22:24

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='FilterSettings',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('last_updated', models.DateTimeField(auto_now=True, verbose_name='Last Updated')),
            ],
            options={
                'verbose_name': 'Request Filter Settings',
                'verbose_name_plural': 'Request Filter Settings',
            },
        ),
        migrations.CreateModel(
            name='Filter',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('filter_type', models.CharField(choices=[('IP', 'IP'), ('USER_AGENT', 'User Agent'), ('PATH', 'Path'), ('QUERY_STRING', 'Query String'), ('REFERER', 'Referer'), ('COUNTRY', 'Country')], default='IP', max_length=20, verbose_name='Filter Type')),
                ('method', models.CharField(choices=[('ABSOLUTE', 'Absolute'), ('WILDCARD', 'Wildcard'), ('REGEX', 'Regex')], default='ABSOLUTE', max_length=20, verbose_name='Method')),
                ('action', models.CharField(choices=[('ALLOW', 'Allow'), ('BLOCK', 'Block'), ('REDIRECT', 'Redirect'), ('LOG', 'Log')], default='BLOCK', max_length=20, verbose_name='Action')),
                ('action_value', models.CharField(blank=True, help_text='The value to use for the action. For example, if you are redirecting, you would enter the URL here.', max_length=255, verbose_name='Action Value')),
                ('filter_value', models.CharField(help_text='The value to filter on. For example, if you are filtering on IP, you would enter an IP address or CIDR range here.', max_length=255, verbose_name='Filter Value')),
                ('active', models.BooleanField(default=True, verbose_name='Active')),
                ('settings', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='filters', to='request_filters.filtersettings')),
            ],
            options={
                'verbose_name': 'Filter',
                'verbose_name_plural': 'Filters',
            },
        ),
    ]
