# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-06 05:29
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 = [
        ('auth', '0008_alter_user_username_max_length'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='State',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created On')),
                ('modified_date', models.DateTimeField(auto_now=True, verbose_name='Modified On')),
                ('name', models.CharField(max_length=256, unique=True, verbose_name='State Name')),
                ('label', models.CharField(max_length=256, verbose_name='State Label')),
                ('created_by_id', models.ForeignKey(db_column='created_by_id', default=1, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='createdntwf_state_related', to=settings.AUTH_USER_MODEL)),
                ('modified_by_id', models.ForeignKey(db_column='modified_by_id', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='modifiedntwf_state_related', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Transition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created On')),
                ('modified_date', models.DateTimeField(auto_now=True, verbose_name='Modified On')),
                ('name', models.CharField(max_length=256, verbose_name='Name')),
                ('action', models.CharField(choices=[('backward', 'Backward'), ('forward', 'Forward')], max_length=16, verbose_name='Action Type')),
                ('is_initial', models.BooleanField(default=False, verbose_name='Initial State')),
                ('is_final', models.BooleanField(default=False, verbose_name='Final State')),
                ('auth_type', models.CharField(choices=[('template', 'Template'), ('user', 'User'), ('group', 'Group')], max_length=16, verbose_name='Auth Type')),
                ('auth_group', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='auth.Group')),
                ('auth_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
                ('created_by_id', models.ForeignKey(db_column='created_by_id', default=1, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='createdntwf_transition_related', to=settings.AUTH_USER_MODEL)),
                ('modified_by_id', models.ForeignKey(db_column='modified_by_id', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='modifiedntwf_transition_related', to=settings.AUTH_USER_MODEL)),
                ('state_from_id', models.ForeignKey(db_column='state_from_id', on_delete=django.db.models.deletion.CASCADE, related_name='state_from', to='ntwf.State')),
                ('state_to_id', models.ForeignKey(db_column='state_to_id', on_delete=django.db.models.deletion.CASCADE, related_name='state_to', to='ntwf.State')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='WorkFlow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created On')),
                ('modified_date', models.DateTimeField(auto_now=True, verbose_name='Modified On')),
                ('name', models.CharField(max_length=256, verbose_name='Name')),
                ('is_template', models.BooleanField(default=True, verbose_name='Is Template')),
                ('response_message', models.CharField(max_length=512, null=True, verbose_name='Response')),
                ('res_app', models.CharField(max_length=256, verbose_name='Application Name')),
                ('res_model', models.CharField(max_length=256, verbose_name='Model Name')),
                ('res_id', models.IntegerField(null=True, verbose_name='Record Id')),
                ('chart_data', models.TextField(null=True, verbose_name='Chart Data')),
                ('active_state', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='wf_state', to='ntwf.State')),
                ('created_by_id', models.ForeignKey(db_column='created_by_id', default=1, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='createdntwf_workflow_related', to=settings.AUTH_USER_MODEL)),
                ('modified_by_id', models.ForeignKey(db_column='modified_by_id', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='modifiedntwf_workflow_related', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='transition',
            name='workflow_id',
            field=models.ForeignKey(db_column='workflow_id', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='workflow_transition', to='ntwf.WorkFlow'),
        ),
    ]
