# Generated by Django 2.0 on 2017-12-24 18:24

import datetime

from django.db import migrations

ADMINS_DATA = [
    {
        'id': 1,
        'username': 'admin',
        'email': 'admin@toothpickshare.com',
        'password': 'password',
        'first_name': 'Super',
        'last_name': 'Admin',
    },
]

USERS_DATA = [
    {
        'id': 2,
        'username': 'linntroll',
        'email': 'pavel.hoodoleev@gmail.com',
        'password': 'password',
        'first_name': 'Pavel',
        'last_name': 'Khudolieiev',
    },
    {
        'id': 3,
        'username': 'toivolefttinen',
        'email': 'toivolefttinen@gmail.com',
        'password': 'password',
        'first_name': 'Toivo',
        'last_name': 'Lefttinen',
    },
    {
        'id': 4,
        'username': 'carlgustaff',
        'email': 'carl_gustaf@kungahuset.se',
        'password': 'password',
        'first_name': 'Carl Gustaf',
        'last_name': 'Folke Hubertus',
    },
    {
        'id': 5,
        'username': 'gvanrossum',
        'email': 'guido@python.org',
        'password': 'password',
        'first_name': 'Guido',
        'last_name': 'van Rossum',
    },
    {
        'id': 6,
        'username': 'rms',
        'email': 'richard@stallman.org',
        'password': 'password',
        'first_name': 'Richard',
        'last_name': 'Stallman',
    },
    {
        'id': 7,
        'username': 'dschinghiskhan',
        'email': 'dschinghiskhan@ulanbator.mn',
        'password': 'password',
        'first_name': 'Dschinghis',
        'last_name': 'Khan',
    },
    {
        'id': 8,
        'username': 'vasiliygupalo',
        'email': 'vasiliygupalo@mail.org',
        'password': 'password',
        'first_name': 'Vasiliy',
        'last_name': 'Gupalo',
    },
]

TOOTHPICK_DATA = [
    {
        'id': 1,
        'serial_number': 'CH 0000000001',
        'name': 'Чингис хааны илд',
        'created_at': datetime.datetime(1181, 2, 17, 0, 0, 0),
    },
    {
        'id': 2,
        'serial_number': 'ZB 0315888823',
        'name': 'Северная 28',
        'created_at': datetime.datetime(2014, 8, 26, 0, 0, 0),
    },
    {
        'id': 3,
        'serial_number': 'DS 6700458812',
        'name': 'Zahnstocher 4000',
        'created_at': datetime.datetime(2016, 1, 12, 0, 0, 0),
    },
]

TOOTHPICK_OWN_DATA = [
    {
        'id': 1,
        'toothpick_id': 1,
        'user_id': 7,
        'enabled': None,
        'own_start_at': datetime.datetime(1181, 2, 17, 0, 0, 0),
        'own_end_at': datetime.datetime(1227, 8, 18, 0, 0, 0),
    },
    {
        'id': 2,
        'toothpick_id': 1,
        'user_id': 6,
        'enabled': None,
        'own_start_at': datetime.datetime(1985, 7, 15, 0, 0, 0),
        'own_end_at': datetime.datetime(1994, 1, 1, 0, 0, 0),
    },
    {
        'id': 3,
        'toothpick_id': 1,
        'user_id': 5,
        'enabled': None,
        'own_start_at': datetime.datetime(1994, 1, 1, 0, 0, 0),
        'own_end_at': datetime.datetime(2013, 8, 19, 0, 0, 0),
    },
    {
        'id': 4,
        'toothpick_id': 1,
        'user_id': 4,
        'enabled': None,
        'own_start_at': datetime.datetime(2013, 8, 19, 0, 0, 0),
        'own_end_at': datetime.datetime(2013, 8, 20, 0, 0, 0),
    },
    {
        'id': 5,
        'toothpick_id': 1,
        'user_id': 3,
        'enabled': None,
        'own_start_at': datetime.datetime(2015, 2, 6, 0, 0, 0),
        'own_end_at': datetime.datetime(2016, 1, 28, 0, 0, 0),
    },
    {
        'id': 6,
        'toothpick_id': 1,
        'user_id': 8,
        'enabled': None,
        'own_start_at': datetime.datetime(2016, 1, 28, 0, 0, 0),
        'own_end_at': datetime.datetime(2016, 12, 31, 0, 0, 0),
    },
    {
        'id': 7,
        'toothpick_id': 1,
        'user_id': 2,
        'enabled': True,
        'own_start_at': datetime.datetime(2017, 1, 1, 0, 0, 0),
        'own_end_at': None,
    },
    {
        'id': 8,
        'toothpick_id': 2,
        'user_id': 8,
        'enabled': True,
        'own_start_at': datetime.datetime(2017, 1, 1, 0, 0, 0),
        'own_end_at': None,
    },
    {
        'id': 9,
        'toothpick_id': 3,
        'user_id': 3,
        'enabled': True,
        'own_start_at': datetime.datetime(2017, 12, 24, 0, 0, 0),
        'own_end_at': None,
    },
    {
        'id': 10,
        'toothpick_id': 3,
        'user_id': 2,
        'enabled': True,
        'own_start_at': datetime.datetime(2017, 12, 24, 0, 0, 0),
        'own_end_at': None,
    },
]


def forwards_func(apps, schema_editor):
    from django.contrib.auth.models import User
    Toothpick = apps.get_model('core', 'Toothpick')
    ToothpickOwnership = apps.get_model('core', 'ToothpickOwnership')
    for data in ADMINS_DATA:
        admin = User.objects.create_superuser(**data)
        admin.save()
    for data in USERS_DATA:
        admin = User.objects.create_user(**data)
        admin.save()
    for data in TOOTHPICK_DATA:
        toothpick = Toothpick(**data)
        toothpick.save()
    for data in TOOTHPICK_OWN_DATA:
        toothpick_own = ToothpickOwnership(**data)
        toothpick_own.save()


def reverse_func(apps, schema_editor):
    pass


class Migration(migrations.Migration):
    dependencies = [
        ('core', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(forwards_func, reverse_func),
    ]
