# Generated by Django 3.2.13 on 2022-07-12 20:00

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


class Migration(migrations.Migration):
    dependencies = [
        ("database", "0082_add_import_job_data_mixin"),
    ]

    operations = [
        migrations.AddField(
            model_name="formviewfieldoptions",
            name="condition_type",
            field=models.CharField(
                choices=[("AND", "And"), ("OR", "Or")],
                default="AND",
                help_text="Indicates whether all (AND) or any (OR) of the conditions "
                "should match before shown.",
                max_length=3,
            ),
        ),
        migrations.AddField(
            model_name="formviewfieldoptions",
            name="show_when_matching_conditions",
            field=models.BooleanField(
                default=False,
                help_text="Indicates whether this field is visible when the "
                "conditions are met.",
            ),
        ),
        migrations.CreateModel(
            name="FormViewFieldOptionsCondition",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "type",
                    models.CharField(
                        help_text="Indicates how the field's value must be compared to "
                        "the filter's value. The filter is always in this "
                        "order `field` `type` `value` (example: `field_1` "
                        "`contains` `Test`).",
                        max_length=48,
                    ),
                ),
                (
                    "value",
                    models.CharField(
                        blank=True,
                        help_text="The filter value that must be compared to the "
                        "field's value.",
                        max_length=255,
                    ),
                ),
                (
                    "field",
                    models.ForeignKey(
                        help_text="The field of which the value must be compared to "
                        "the filter value.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="database.field",
                    ),
                ),
                (
                    "field_option",
                    models.ForeignKey(
                        help_text="The form view option where the condition is "
                        "related to.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="conditions",
                        to="database.formviewfieldoptions",
                    ),
                ),
            ],
            options={
                "ordering": ("id",),
            },
        ),
    ]
