# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-14 20:27
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import featreq.utils
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ClientInfo',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='Client ID')),
                ('name', models.CharField(db_index=True, max_length=64, verbose_name='Client name')),
                ('con_name', models.CharField(blank=True, default='', max_length=64, verbose_name='Contact name')),
                ('con_mail', models.EmailField(blank=True, default='', max_length=254, verbose_name='Contact email')),
                ('date_add', models.DateTimeField(blank=True, default=featreq.utils.approxnow, editable=False, verbose_name='Date added')),
            ],
            options={
                'db_table': 'clients',
                'verbose_name': 'client',
                'verbose_name_plural': 'clients',
            },
        ),
        migrations.CreateModel(
            name='ClosedReq',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('priority', models.SmallIntegerField(blank=True, default=None, null=True, verbose_name='Priority')),
                ('date_tgt', models.DateTimeField(blank=True, default=None, null=True, verbose_name='Target date')),
                ('opened_at', models.DateTimeField(editable=False, verbose_name='Opened at')),
                ('opened_by', models.CharField(editable=False, max_length=30, verbose_name='Opened by')),
                ('closed_at', models.DateTimeField(blank=True, default=featreq.utils.approxnow, editable=False, verbose_name='Closed at')),
                ('closed_by', models.CharField(editable=False, max_length=30, verbose_name='Closed by')),
                ('status', models.CharField(choices=[('', 'Select status'), ('C', 'Complete'), ('R', 'Rejected'), ('D', 'Deferred')], default='C', max_length=1, verbose_name='Closed as')),
                ('reason', models.CharField(blank=True, default='', max_length=128, verbose_name='Details')),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='closed_list', to='featreq.ClientInfo', verbose_name='Client')),
            ],
            options={
                'db_table': 'closedreqs',
                'verbose_name': 'closed request',
                'verbose_name_plural': 'closed requests',
            },
        ),
        migrations.CreateModel(
            name='FeatureReq',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='Request ID')),
                ('title', models.CharField(max_length=128, verbose_name='Summary')),
                ('desc', models.TextField(verbose_name='Description')),
                ('ref_url', models.URLField(blank=True, default='', max_length=254, verbose_name='Reference URL')),
                ('prod_area', models.CharField(choices=[('', 'Select area'), ('PO', 'Policies'), ('BI', 'Billing'), ('CL', 'Claims'), ('RE', 'Reports')], max_length=2, verbose_name='Product area')),
                ('date_cr', models.DateTimeField(blank=True, db_index=True, default=featreq.utils.approxnow, editable=False, verbose_name='Created at')),
                ('date_up', models.DateTimeField(blank=True, default=featreq.utils.approxnow, editable=False, verbose_name='Updated at')),
                ('user_cr', models.CharField(editable=False, max_length=30, verbose_name='Created by')),
                ('user_up', models.CharField(editable=False, max_length=30, verbose_name='Updated by')),
            ],
            options={
                'db_table': 'featreqs',
                'verbose_name': 'request',
                'verbose_name_plural': 'requests',
            },
        ),
        migrations.CreateModel(
            name='OpenReq',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('priority', models.SmallIntegerField(blank=True, default=None, null=True, verbose_name='Priority')),
                ('date_tgt', models.DateTimeField(blank=True, default=None, null=True, verbose_name='Target date')),
                ('opened_at', models.DateTimeField(blank=True, default=featreq.utils.approxnow, editable=False, verbose_name='Opened at')),
                ('opened_by', models.CharField(editable=False, max_length=30, verbose_name='Opened by')),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='open_list', to='featreq.ClientInfo', verbose_name='Client')),
                ('req', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='open_list', to='featreq.FeatureReq', verbose_name='Request')),
            ],
            options={
                'db_table': 'openreqs',
                'verbose_name': 'open request',
                'verbose_name_plural': 'open requests',
            },
        ),
        migrations.AddField(
            model_name='closedreq',
            name='req',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='closed_list', to='featreq.FeatureReq', verbose_name='Request'),
        ),
        migrations.AddField(
            model_name='clientinfo',
            name='closedreqs',
            field=models.ManyToManyField(related_name='closedclients', through='featreq.ClosedReq', to='featreq.FeatureReq'),
        ),
        migrations.AddField(
            model_name='clientinfo',
            name='openreqs',
            field=models.ManyToManyField(related_name='openclients', through='featreq.OpenReq', to='featreq.FeatureReq'),
        ),
        migrations.AlterUniqueTogether(
            name='openreq',
            unique_together=set([('client', 'req')]),
        ),
        migrations.AlterIndexTogether(
            name='openreq',
            index_together=set([('client', 'priority')]),
        ),
    ]
