# Generated by Django 3.1 on 2020-08-30 21:00

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Invoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('total_tax', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('tax_type', models.CharField(choices=[('GST', 'GST')], default='GST', max_length=64)),
                ('total_price', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('grand_total', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('price', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('qty', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('tax_percentage', models.FloatField()),
                ('tax_type', models.CharField(choices=[('GST', 'GST')], default='GST', max_length=64)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Item_details',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('igst_tax_percentage', models.FloatField(blank=True, null=True)),
                ('sgst_tax_percentage', models.FloatField(blank=True, null=True)),
                ('cgst_tax_percentage', models.FloatField(blank=True, null=True)),
                ('igst_amt', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('sgst_amt', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('cgst_amt', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_date', models.DateField()),
                ('total_price', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('grand_total', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('order_payment_status', models.CharField(choices=[('PENDING', 'PENDING'), ('IN_PROCESS', 'IN_PROCESS'), ('PAID', 'PAID'), ('COD', 'COD')], default='PENDING', max_length=64)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('email', models.EmailField(max_length=254)),
                ('user_type', models.CharField(choices=[('BUYER', 'BUYER'), ('SELLER', 'SELLER'), ('BROKER', 'BROKER'), ('GUEST', 'GUEST')], default='BUYER', max_length=64)),
                ('gstin', gst_field.modelfields.GSTField(blank=True, max_length=15, null=True)),
                ('pan', gst_field.modelfields.PANField(blank=True, max_length=10, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('external_transaction_id', models.CharField(blank=True, max_length=128, null=True, unique=True)),
                ('transaction_hash', models.CharField(blank=True, max_length=254, null=True)),
                ('transaction_status', models.CharField(choices=[('INITIATED', 'INITIATED'), ('SUCCESS', 'SUCCESS'), ('FAILURE', 'FAILURE')], default='INITIATED', max_length=64)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='invoice.order')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='invoice.user')),
            ],
        ),
        migrations.CreateModel(
            name='Order_Item_Relationship',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('qty', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='invoice.item')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='invoice.order')),
            ],
        ),
        migrations.AddField(
            model_name='order',
            name='buyer',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='invoice.user'),
        ),
        migrations.AddField(
            model_name='order',
            name='items',
            field=models.ManyToManyField(through='invoice.Order_Item_Relationship', to='invoice.Item'),
        ),
        migrations.AddField(
            model_name='item',
            name='item_details',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='invoice.item_details'),
        ),
        migrations.AddField(
            model_name='item',
            name='seller',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='invoice.user'),
        ),
        migrations.CreateModel(
            name='Invoice_Item_Relationship',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('qty', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True)),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='invoice.invoice')),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='invoice.item')),
                ('item_details', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='invoice.item_details')),
            ],
        ),
        migrations.AddField(
            model_name='invoice',
            name='items',
            field=models.ManyToManyField(through='invoice.Invoice_Item_Relationship', to='invoice.Item'),
        ),
        migrations.AddField(
            model_name='invoice',
            name='order',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='invoice.order'),
        ),
        migrations.CreateModel(
            name='Address',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('line1', models.CharField(max_length=50)),
                ('line2', models.CharField(max_length=50)),
                ('address_type', models.CharField(choices=[('HOME', 'HOME'), ('WORK', 'WORK')], default='WORK', max_length=64)),
                ('is_primary', models.BooleanField(default=True)),
                ('city', models.CharField(default='Jammu', max_length=60)),
                ('state', models.CharField(default='J&K', max_length=30)),
                ('zipcode', models.CharField(default='180001', max_length=6)),
                ('country', models.CharField(default='India', max_length=50)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='invoice.user')),
            ],
        ),
    ]
