"""Seed all Applet rows."""
from django.db import migrations

APPLETS = [
    # (slug, name, context, default_visible, grid_cols, grid_rows)
    ('wallet',                'Wallet',          'dashboard',  True, 12, 3),
    ('new-post',              'New Post',         'billboard',  True,  9, 3),
    ('my-posts',              'My Posts',         'billboard',  True,  3, 3),
    ('username',              'Username',         'dashboard',  True,  6, 3),
    ('palette',               'Palette',          'dashboard',  True,  6, 3),
    ('new-game',              'New Game',         'gameboard',  True,  4, 3),
    ('my-games',              'My Games',         'gameboard',  True,  4, 4),
    ('game-kit',              'Game Kit',         'gameboard',  True,  4, 3),
    ('wallet-balances',       'Wallet Balances',  'wallet',     True,  3, 3),
    ('wallet-tokens',         'Wallet Tokens',    'wallet',     True,  3, 3),
    ('wallet-payment',        'Payment Methods',  'wallet',     True,  6, 3),
    ('billboard-my-scrolls',  'My Scrolls',       'billboard',  True,  4, 3),
    ('billboard-my-contacts', 'Contacts',         'billboard',  True,  4, 3),
    ('billboard-most-recent', 'Most Recent',      'billboard',  True,  8, 6),
    ('gk-trinkets',           'Trinkets',         'game-kit',   True,  3, 3),
    ('gk-tokens',             'Tokens',           'game-kit',   True,  3, 3),
    ('gk-decks',              'Card Decks',       'game-kit',   True,  3, 3),
    ('gk-dice',               'Dice Sets',        'game-kit',   True,  3, 3),
    ('my-sky',                'My Sky',           'dashboard',  True,  6, 6),
    ('billboard-notes',       'My Notes',         'billboard',  True,  4, 4),
]


def seed(apps, schema_editor):
    Applet = apps.get_model('applets', 'Applet')
    for slug, name, context, default_visible, grid_cols, grid_rows in APPLETS:
        Applet.objects.create(
            slug=slug, name=name, context=context,
            default_visible=default_visible,
            grid_cols=grid_cols, grid_rows=grid_rows,
        )


class Migration(migrations.Migration):

    dependencies = [
        ('applets', '0002_initial'),
    ]

    operations = [
        migrations.RunPython(seed, migrations.RunPython.noop),
    ]
