# Generated by Django 2.2 on 2019-07-09 12:33

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='BotState',
            fields=[
                ('psid', models.BigIntegerField(db_index=True, primary_key=True, serialize=False, unique=True)),
                ('state', models.CharField(db_index=True, max_length=255)),
                ('context', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
            ],
            options={
                'db_table': 'BotState',
            },
        ),
        migrations.CreateModel(
            name='Chain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=255)),
                ('logo_url', models.CharField(db_index=True, max_length=255)),
                ('description', models.CharField(db_index=True, max_length=255)),
            ],
            options={
                'db_table': 'Chain',
            },
        ),
        migrations.CreateModel(
            name='Facility',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('city', models.CharField(db_index=True, max_length=255)),
                ('street', models.CharField(db_index=True, max_length=255)),
                ('label', models.CharField(db_index=True, max_length=255)),
                ('lat', models.DecimalField(db_index=True, decimal_places=6, max_digits=8)),
                ('lon', models.DecimalField(db_index=True, decimal_places=6, max_digits=8)),
                ('chain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.Chain')),
            ],
            options={
                'verbose_name': 'Facility',
                'verbose_name_plural': 'Facilities',
                'db_table': 'Facility',
            },
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=255)),
                ('description', models.CharField(db_index=True, max_length=255)),
                ('image_url', models.CharField(db_index=True, max_length=255)),
                ('price', models.DecimalField(db_index=True, decimal_places=2, max_digits=6)),
                ('type_of_button', models.CharField(choices=[('top', 'Top'), ('midle', 'Midle'), ('bottom', 'Bottom')], db_index=True, max_length=255, verbose_name='Type of Button on the main menu')),
            ],
            options={
                'db_table': 'Item',
            },
        ),
        migrations.CreateModel(
            name='ItemOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('count', models.IntegerField(db_index=True, default=0)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.Item')),
            ],
            options={
                'db_table': 'ItemOrder',
            },
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('in process', 'In process'), ('paid', 'Paid'), ('cooking', 'Cooking'), ('ready', 'Ready'), ('given away', 'Given away'), ('canceled', 'Canceled')], db_index=True, max_length=255)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('facility', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.Facility')),
                ('items', models.ManyToManyField(db_index=True, through='fb_chatbot.ItemOrder', to='fb_chatbot.Item')),
                ('psid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.BotState')),
            ],
            options={
                'db_table': 'Order',
            },
        ),
        migrations.CreateModel(
            name='Menu',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(choices=[('main dishes', 'Main dishes'), ('snacks', 'Snacks'), ('desserts', 'Desserts'), ('drinks', 'Drinks')], db_index=True, max_length=255)),
                ('image_url', models.CharField(db_index=True, max_length=255)),
                ('top_button', models.CharField(db_index=True, max_length=255)),
                ('midle_button', models.CharField(db_index=True, max_length=255)),
                ('bottom_button', models.CharField(db_index=True, max_length=255)),
                ('facility', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.Facility')),
            ],
            options={
                'verbose_name': 'Menu',
                'verbose_name_plural': 'Menu types',
                'db_table': 'Menu',
            },
        ),
        migrations.AddField(
            model_name='itemorder',
            name='order',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.Order'),
        ),
        migrations.AddField(
            model_name='item',
            name='type_of_menu',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fb_chatbot.Menu'),
        ),
    ]
