# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-02 19:29
# flake8: noqa
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import normandy.recipes.fields
import normandy.recipes.validators


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("recipes", "0002_auto_20180406_1701"),
    ]

    operations = [
        migrations.CreateModel(
            name="TmpRecipeRevision",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("created", models.DateTimeField(default=django.utils.timezone.now)),
                ("updated", models.DateTimeField(default=django.utils.timezone.now)),
                ("comment", models.TextField()),
                ("name", models.CharField(max_length=255)),
                (
                    "arguments_json",
                    models.TextField(
                        default="{}", validators=[normandy.recipes.validators.validate_json]
                    ),
                ),
                ("extra_filter_expression", models.TextField()),
                ("identicon_seed", normandy.recipes.fields.IdenticonSeedField(max_length=64)),
                (
                    "action",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="recipes.Action"
                    ),
                ),
                ("channels", models.ManyToManyField(to="recipes.Channel")),
                ("countries", models.ManyToManyField(to="recipes.Country")),
                ("locales", models.ManyToManyField(to="recipes.Locale")),
                (
                    "parent",
                    models.OneToOneField(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="child",
                        to="recipes.TmpRecipeRevision",
                    ),
                ),
                (
                    "recipe",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="recipes.Recipe"
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={"ordering": ("-created",)},
        ),
        migrations.AddField(
            model_name="recipe",
            name="approved_tmp_revision",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="approved_for_recipe",
                to="recipes.TmpRecipeRevision",
            ),
        ),
        migrations.AddField(
            model_name="recipe",
            name="latest_tmp_revision",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="latest_for_recipe",
                to="recipes.TmpRecipeRevision",
            ),
        ),
        migrations.AlterField(
            model_name="approvalrequest",
            name="revision",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="approval_request",
                to="recipes.RecipeRevision",
            ),
        ),
        migrations.AddField(
            model_name="approvalrequest",
            name="tmp_revision",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="approval_request",
                to="recipes.TmpRecipeRevision",
            ),
        ),
    ]
