# Generated by Django 2.2.7 on 2020-05-17 06:20

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='Customer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('customer_id', models.CharField(max_length=32, unique=True)),
                ('customer_name', models.CharField(blank=True, max_length=32)),
                ('customer_email', models.EmailField(max_length=254, unique=True)),
                ('customer_phone', models.CharField(blank=True, max_length=16)),
                ('customer_pin', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'nitro_customer',
            },
        ),
        migrations.CreateModel(
            name='Discount',
            fields=[
                ('discount_id', models.CharField(max_length=150, primary_key=True, serialize=False)),
                ('discount_name', models.CharField(max_length=150)),
                ('discount_percent', models.FloatField()),
                ('discount_amount', models.FloatField()),
                ('discount_total_order', models.BooleanField(default=False)),
                ('discount_total_uses', models.IntegerField()),
                ('discount_current_uses', models.IntegerField(default=0)),
            ],
            options={
                'db_table': 'nitro_discount',
            },
        ),
        migrations.CreateModel(
            name='Matching',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('side', models.IntegerField()),
            ],
            options={
                'db_table': 'nitro_sku_pos',
            },
        ),
        migrations.CreateModel(
            name='POS',
            fields=[
                ('pos_id', models.CharField(max_length=3, primary_key=True, serialize=False)),
                ('pos_sn', models.CharField(max_length=255)),
                ('pos_auth_string', models.CharField(blank=True, max_length=255, null=True)),
                ('location', models.CharField(blank=True, max_length=255, null=True)),
                ('deploy_state', models.BooleanField()),
            ],
            options={
                'db_table': 'nitro_pos',
            },
        ),
        migrations.CreateModel(
            name='Promo',
            fields=[
                ('code', models.CharField(max_length=32, primary_key=True, serialize=False, unique=True)),
                ('start_date', models.DateField()),
                ('end_date', models.DateField()),
                ('discount', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='promo', to='main.Discount')),
            ],
            options={
                'db_table': 'nitro_promo',
            },
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('service_id', models.IntegerField(primary_key=True, serialize=False)),
                ('service_name', models.CharField(max_length=255)),
                ('service_description', models.TextField()),
            ],
            options={
                'db_table': 'nitro_service',
            },
        ),
        migrations.CreateModel(
            name='SKU',
            fields=[
                ('sku_id', models.CharField(max_length=4, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255)),
                ('desc', models.TextField()),
                ('volume', models.IntegerField()),
                ('volume_units', models.IntegerField()),
                ('volume_unit_price_customer', models.FloatField()),
                ('volume_unit_price_guest', models.FloatField()),
                ('image_path', models.CharField(max_length=255, null=True)),
                ('image_path2', models.CharField(max_length=255, null=True)),
                ('last_change', models.DateTimeField(auto_now=True, null=True)),
                ('batch_no', models.CharField(max_length=255, null=True)),
                ('pos', models.ManyToManyField(related_name='skus', through='main.Matching', to='main.POS')),
            ],
            options={
                'db_table': 'nitro_sku',
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('status', models.CharField(auto_created=True, default='NOT_APPROVED', max_length=20)),
                ('transaction_id', models.BigIntegerField(primary_key=True, serialize=False)),
                ('order_id', models.UUIDField()),
                ('web_link', models.URLField()),
                ('app_link', models.URLField()),
                ('payment_access_token', models.CharField(max_length=20)),
                ('amount', models.FloatField(default=0, null=True)),
                ('payment_method', models.CharField(max_length=50, null=True)),
                ('credit_card_nick_name', models.CharField(max_length=127, null=True)),
                ('credit_card_brand', models.CharField(max_length=20, null=True)),
                ('reg_key', models.CharField(max_length=20, null=True)),
                ('transaction_date', models.DateTimeField(null=True)),
                ('customer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='transaction', to='main.Customer')),
                ('pos', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='transaction', to='main.POS')),
                ('promo', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='transaction', to='main.Promo')),
                ('sku', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='transaction', to='main.SKU')),
            ],
            options={
                'db_table': 'nitro_transaction',
            },
        ),
        migrations.CreateModel(
            name='ServicePersonnel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('personnel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='personnel', to=settings.AUTH_USER_MODEL)),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service', to='main.Service')),
            ],
            options={
                'db_table': 'nitro_service_personnel',
            },
        ),
        migrations.CreateModel(
            name='ServiceLog',
            fields=[
                ('service_log_id', models.AutoField(primary_key=True, serialize=False)),
                ('service_datetime', models.DateTimeField(auto_now=True)),
                ('personnel', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='service_log', to=settings.AUTH_USER_MODEL)),
                ('pos', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='service_log', to='main.POS')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='service_log', to='main.Service')),
            ],
            options={
                'db_table': 'nitro_service_log',
            },
        ),
        migrations.AddField(
            model_name='service',
            name='personnel',
            field=models.ManyToManyField(related_name='service', through='main.ServicePersonnel', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='OrderLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_id', models.UUIDField()),
                ('transaction_status', models.CharField(max_length=20)),
                ('order_volume', models.IntegerField(null=True)),
                ('order_value', models.FloatField(null=True)),
                ('discount_total', models.FloatField(null=True)),
                ('customer_payment_net', models.FloatField(null=True)),
                ('customer_payment_base', models.FloatField(null=True)),
                ('customer_payment_vat', models.FloatField(null=True)),
                ('order_timeout', models.BooleanField(null=True)),
                ('order_datetime', models.DateTimeField(auto_now=True)),
                ('customer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='orderlog', to='main.Customer')),
                ('pos', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='orderlog', to='main.POS')),
                ('promo', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='orderlog', to='main.Promo')),
                ('sku', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='orderlog', to='main.SKU')),
                ('transaction', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='orderlog', to='main.Transaction')),
            ],
            options={
                'db_table': 'nitro_orderlog',
            },
        ),
        migrations.AddField(
            model_name='matching',
            name='matched_pos',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.POS'),
        ),
        migrations.AddField(
            model_name='matching',
            name='sku',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.SKU'),
        ),
        migrations.CreateModel(
            name='LocationProduct',
            fields=[
                ('location_product_id', models.AutoField(primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now=True)),
                ('batch_no', models.CharField(max_length=255)),
                ('personnel', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='location_product', to=settings.AUTH_USER_MODEL)),
                ('pos', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='location_product', to='main.POS')),
                ('sku', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='location_product', to='main.SKU')),
            ],
            options={
                'db_table': 'nitro_location_product',
            },
        ),
        migrations.AddField(
            model_name='customer',
            name='discount',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='customer', to='main.Discount'),
        ),
    ]
