"""Mark RWS + Minchiate Fiorentine as free-in-shop ($0) decks.

These two stock decks are offered free in the wallet Shop applet — a one-
click claim adds them to a user's `unlocked_decks` (no Stripe). Earthman is
deliberately left False: it's auto-granted at signup, not shopped.
"""
from django.db import migrations


FREE_SLUGS = ("tarot-rider-waite-smith", "minchiate-fiorentine-1860-1890")


def set_free_in_shop(apps, schema_editor):
    DeckVariant = apps.get_model("epic", "DeckVariant")
    DeckVariant.objects.filter(slug__in=FREE_SLUGS).update(free_in_shop=True)


def unset_free_in_shop(apps, schema_editor):
    DeckVariant = apps.get_model("epic", "DeckVariant")
    DeckVariant.objects.filter(slug__in=FREE_SLUGS).update(free_in_shop=False)


class Migration(migrations.Migration):

    dependencies = [
        ("epic", "0015_deckvariant_free_in_shop"),
    ]

    operations = [
        migrations.RunPython(set_free_in_shop, unset_free_in_shop),
    ]
