# Generated by Django 2.2.6 on 2020-03-08 19:07

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


class Migration(migrations.Migration):

    dependencies = [
        ('users', '0024_auto_20200305_1638'),
        ('business', '0016_auto_20200307_1345'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentSchedule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bidRequestTitle', models.CharField(blank=True, max_length=50, null=True, verbose_name='借款名称')),
                ('deadLine', models.DateTimeField(null=True, verbose_name='本期还款截止期限')),
                ('payDate', models.DateTimeField(null=True, verbose_name='还款时间')),
                ('totalAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='本期还款总金额')),
                ('principal', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='本期还款本金')),
                ('interest', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='本期还款总利息')),
                ('monthIndex', models.IntegerField(blank=True, null=True, verbose_name='第几期')),
                ('state', models.IntegerField(blank=True, choices=[(0, '正常待还'), (1, '已还'), (2, '逾期')], default=0, null=True, verbose_name='本期还款状态')),
                ('bidRequestType', models.IntegerField(blank=True, choices=[(0, '普通信用标'), (1, '普通信用标')], null=True, verbose_name='借款类型(信用标)')),
                ('returnType', models.IntegerField(blank=True, choices=[(0, '按月分期还款'), (1, '按月到期还款')], null=True, verbose_name='还款方式')),
                ('bidRequestId', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='PaymentSchedules', to='business.BidRequest', verbose_name='借款标')),
                ('borrower', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='PaymentSchedules', to='users.Borrower', verbose_name='还款人')),
            ],
            options={
                'verbose_name': '还款计划',
                'verbose_name_plural': '还款计划',
            },
        ),
        migrations.CreateModel(
            name='SystemAccount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('usableAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='平台账户剩余金额')),
                ('freezedAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='平台账户冻结金额')),
            ],
            options={
                'verbose_name': '平台账户',
                'verbose_name_plural': '平台账户',
            },
        ),
        migrations.AlterModelOptions(
            name='bidrequestaudithistory',
            options={'verbose_name': '所有标的审核历史', 'verbose_name_plural': '所有标的审核历史'},
        ),
        migrations.AlterField(
            model_name='accountflow',
            name='accountId',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Account', verbose_name='用户账户'),
        ),
        migrations.CreateModel(
            name='SystemAccountFlow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='变化的余额')),
                ('accountActionType', models.IntegerField(blank=True, choices=[(1, '账户管理费'), (2, '利息管理费'), (3, '提现手续费')], null=True, verbose_name='资金变化类型')),
                ('createdTime', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('usableAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='平台账户剩余金额')),
                ('freezedAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='平台账户冻结金额')),
                ('note', models.TextField(blank=True, max_length=100, null=True, verbose_name='系统账户流水说明')),
                ('systemAccountId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='business.SystemAccount', verbose_name='用户账户')),
            ],
            options={
                'verbose_name': '平台账户流水',
                'verbose_name_plural': '平台账户流水',
            },
        ),
        migrations.CreateModel(
            name='PaymentScheduleDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bidAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='总共投标金额')),
                ('totalAmount', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='本期还款总金额')),
                ('principal', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='本期应还款本金')),
                ('interest', models.DecimalField(decimal_places=4, default=0.0, max_digits=18, verbose_name='本期应还款利息')),
                ('monthIndex', models.IntegerField(blank=True, null=True, verbose_name='第几期')),
                ('deadline', models.DateTimeField(null=True, verbose_name='本期还款截止期限')),
                ('payDate', models.DateTimeField(null=True, verbose_name='实际付款日期')),
                ('returnType', models.IntegerField(blank=True, choices=[(0, '按月分期还款'), (1, '按月到期还款')], null=True, verbose_name='还款方式')),
                ('bidId', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='PaymentScheduleDetails', to='business.Bid', verbose_name='借款标来源')),
                ('bidRequestId', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='PaymentScheduleDetails', to='business.BidRequest', verbose_name='借款标')),
                ('borrower', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='PaymentScheduleDetails', to='users.Borrower', verbose_name='还款人')),
                ('investor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='PaymentScheduleDetails', to='users.Investor', verbose_name='收款人')),
                ('paymentScheduleId', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='PaymentScheduleDetails', to='business.PaymentSchedule', verbose_name='借款标')),
            ],
            options={
                'verbose_name': '投资人的回款明细',
                'verbose_name_plural': '投资人的回款明细',
            },
        ),
    ]
