# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-03-21 07:57
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),
    ]

    operations = [
        migrations.CreateModel(
            name='_FlowBecome_Full_Staff',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('probation_start_date', models.DateField(verbose_name='入职日期')),
                ('probation_end_date', models.DateField(verbose_name='转正日期')),
            ],
        ),
        migrations.CreateModel(
            name='_FlowLoan',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('usage', models.SmallIntegerField(choices=[(0, '出差借款')], verbose_name='用途')),
                ('amount', models.PositiveIntegerField(verbose_name='借款金额')),
                ('start_date', models.DateTimeField(verbose_name='用款时间')),
                ('end_date', models.DateTimeField(verbose_name='还款时间')),
            ],
        ),
        migrations.CreateModel(
            name='_FlowTrip',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_date', models.DateTimeField(verbose_name='开始时间')),
                ('end_date', models.DateTimeField(verbose_name='结束时间')),
            ],
        ),
        migrations.CreateModel(
            name='_FlowVaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('vaction_type', models.SmallIntegerField(choices=[(0, '病假'), (1, '年假'), (2, '事假'), (3, '产假')], default=2)),
                ('start_date', models.DateTimeField(verbose_name='开始时间')),
                ('end_date', models.DateTimeField(verbose_name='结束时间')),
            ],
        ),
        migrations.CreateModel(
            name='Flow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField(blank=True, null=True, verbose_name='申请内容')),
                ('started_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='流程发起人')),
            ],
        ),
        migrations.CreateModel(
            name='FlowRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.SmallIntegerField(choices=[(0, '同意'), (1, '拒绝'), (2, '需额外审批人审批')], verbose_name='审批状态')),
                ('comment', models.TextField(max_length=1024, verbose_name='审批意见')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('extra_parties', models.ManyToManyField(related_name='related_parties', to=settings.AUTH_USER_MODEL, verbose_name='额外审批人列表')),
            ],
        ),
        migrations.CreateModel(
            name='FlowRole',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True)),
                ('users', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='FlowTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('flow_type', models.CharField(choices=[('_FlowVaction', '请假流程'), ('_FlowTrip', '出差申请'), ('_FlowBecome_Full_Staff', '转正申请'), ('_FlowLoan', '借款申请')], max_length=64)),
            ],
        ),
        migrations.CreateModel(
            name='Step',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='环节名称')),
                ('description', models.TextField(blank=True, null=True, verbose_name='环节介绍')),
                ('order', models.PositiveSmallIntegerField(verbose_name='环节步骤')),
                ('is_countersign', models.BooleanField(default=False, verbose_name='会签环节')),
                ('required_polls', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='会签最少需同意的人数')),
                ('flow_template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.FlowTemplate', verbose_name='所属流程')),
                ('role', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='审批角色')),
            ],
        ),
        migrations.AddField(
            model_name='flowrecord',
            name='step',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.Step'),
        ),
        migrations.AddField(
            model_name='flowrecord',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='flow',
            name='template',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.FlowTemplate'),
        ),
        migrations.AddField(
            model_name='_flowvaction',
            name='flow',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.Flow'),
        ),
        migrations.AddField(
            model_name='_flowtrip',
            name='flow',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.Flow'),
        ),
        migrations.AddField(
            model_name='_flowloan',
            name='flow',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.Flow'),
        ),
        migrations.AddField(
            model_name='_flowbecome_full_staff',
            name='flow',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='beeflow.Flow'),
        ),
        migrations.AlterUniqueTogether(
            name='step',
            unique_together=set([('flow_template', 'order')]),
        ),
    ]
