# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-08-14 09:02
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('services', '0003_auto_20160813_1717'),
    ]

    operations = [
        migrations.CreateModel(
            name='Dashboard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dashboard_created', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dashboard_updated', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'dashboards',
                'verbose_name': 'dashboard',
            },
        ),
        migrations.CreateModel(
            name='UserDashboard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('user_id', models.IntegerField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='userdashboard_created', to=settings.AUTH_USER_MODEL)),
                ('dashboards', models.ManyToManyField(related_name='dashboards', to='dashboards.Dashboard')),
                ('default_dashboard', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='default', to='dashboards.Dashboard')),
                ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='userdashboard_updated', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'users dashboards',
                'verbose_name': 'user dashboard',
            },
        ),
        migrations.CreateModel(
            name='Widget',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('type_of', models.CharField(choices=[('bars', 'Bar Graph'), ('last', 'Last'), ('lines', 'Lines'), ('pie', 'Pie Chart')], max_length=10)),
                ('data_from', models.CharField(max_length=20)),
                ('interval', models.CharField(max_length=20)),
                ('nulls', models.CharField(blank=True, choices=[('omit', 'Omit')], max_length=20, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='widget_created', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'widgets',
                'verbose_name': 'widget',
            },
        ),
        migrations.CreateModel(
            name='WidgetData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('key', models.CharField(max_length=200)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='widgetdata_created', to=settings.AUTH_USER_MODEL)),
                ('service', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='services_metrics', to='services.Service')),
                ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='widgetdata_updated', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'widget data sources',
                'verbose_name': 'widget data',
            },
        ),
        migrations.AddField(
            model_name='widget',
            name='data',
            field=models.ManyToManyField(blank=True, to='dashboards.WidgetData'),
        ),
        migrations.AddField(
            model_name='widget',
            name='updated_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='widget_updated', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='dashboard',
            name='widgets',
            field=models.ManyToManyField(blank=True, to='dashboards.Widget'),
        ),
    ]
