# Generated by Django 4.2.23 on 2025-08-11 23:51

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


class Migration(migrations.Migration):

    dependencies = [
        ("taxsystem", "0007_alter_ownerupdatestatus_section"),
    ]

    operations = [
        migrations.CreateModel(
            name="JournalFilter",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "filter_type",
                    models.CharField(
                        choices=[("reason", "Reason"), ("amount", "Amount")],
                        max_length=20,
                    ),
                ),
                ("value", models.CharField(max_length=255)),
            ],
            options={
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="JournalFilterSet",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100, unique=True)),
                ("description", models.CharField(blank=True, max_length=255)),
                ("enabled", models.BooleanField(default=True)),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ts_filter_set",
                        to="taxsystem.owneraudit",
                    ),
                ),
            ],
            options={
                "verbose_name": "Journal Filter Set",
                "verbose_name_plural": "Journal Filter Sets",
                "default_permissions": (),
            },
        ),
        migrations.DeleteModel(
            name="FilterAmount",
        ),
        migrations.DeleteModel(
            name="FilterDate",
        ),
        migrations.DeleteModel(
            name="FilterReason",
        ),
        migrations.RemoveField(
            model_name="smartgroup",
            name="filters",
        ),
        migrations.RemoveField(
            model_name="smartgroup",
            name="owner",
        ),
        migrations.DeleteModel(
            name="SmartFilter",
        ),
        migrations.DeleteModel(
            name="SmartGroup",
        ),
        migrations.AddField(
            model_name="journalfilter",
            name="filter_set",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="ts_filters",
                to="taxsystem.journalfilterset",
            ),
        ),
        migrations.AddConstraint(
            model_name="journalfilter",
            constraint=models.UniqueConstraint(
                fields=("filter_set", "value"), name="unique_filter_value_per_set"
            ),
        ),
    ]
