# Generated by Django 2.1.7 on 2019-04-19 21:07

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Booking',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_datetime', models.DateTimeField(auto_now_add=True, verbose_name='预约日期时间')),
                ('start_time', models.TimeField(verbose_name='开始时间')),
                ('end_time', models.TimeField(verbose_name='结束时间')),
                ('date', models.DateField(verbose_name='日期')),
                ('arrive_time', models.TimeField(blank=True, null=True, verbose_name='到达时间')),
                ('leave_time', models.TimeField(blank=True, null=True, verbose_name='离开时间')),
                ('is_valid', models.BooleanField(default=True, verbose_name='是否有效')),
                ('is_cancel', models.BooleanField(default=False, verbose_name='是否取消')),
                ('cancel_datetime', models.DateTimeField(blank=True, null=True, verbose_name='取消日期时间')),
                ('cancel_reason', models.CharField(max_length=512, verbose_name='取消理由')),
                ('cancel_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cancel_by', to=settings.AUTH_USER_MODEL, verbose_name='取消人')),
            ],
            options={
                'verbose_name': '预约',
                'verbose_name_plural': '预约',
            },
        ),
        migrations.CreateModel(
            name='Room',
            fields=[
                ('id', models.CharField(default=uuid.uuid1, max_length=36, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=128, verbose_name='名称')),
                ('decription', models.CharField(blank=True, max_length=512, verbose_name='说明')),
            ],
            options={
                'verbose_name': '房间',
                'verbose_name_plural': '房间',
            },
        ),
        migrations.CreateModel(
            name='Seat',
            fields=[
                ('id', models.CharField(default=uuid.uuid1, max_length=36, primary_key=True, serialize=False, verbose_name='ID')),
                ('creaeted_datetime', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='booking.Room', verbose_name='房间')),
            ],
            options={
                'verbose_name': '座位',
                'verbose_name_plural': '座位',
            },
        ),
        migrations.CreateModel(
            name='Setting',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pre_booking_interval_day', models.IntegerField(default=30, verbose_name='提前预约时间间隔（天）')),
                ('booking_interval', models.IntegerField(default=30, verbose_name='预约间隔（分钟）')),
                ('start_time', models.TimeField(default=datetime.time(8, 0), verbose_name='开始时间')),
                ('end_time', models.TimeField(default=datetime.time(21, 0), verbose_name='结束时间')),
                ('punish_point', models.IntegerField(default=5, verbose_name='惩罚积分数')),
                ('reward_point', models.IntegerField(default=10, verbose_name='奖励积分数')),
            ],
            options={
                'verbose_name': '预约设置',
                'verbose_name_plural': '预约设置',
            },
        ),
        migrations.AddField(
            model_name='booking',
            name='room',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='booking.Room', verbose_name='房间'),
        ),
        migrations.AddField(
            model_name='booking',
            name='seat',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='booking.Seat', verbose_name='座位'),
        ),
        migrations.AddField(
            model_name='booking',
            name='seats',
            field=models.ManyToManyField(related_name='seats', to='booking.Seat', verbose_name='多个座位'),
        ),
        migrations.AddField(
            model_name='booking',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='预约人'),
        ),
    ]
