# Generated by Django 4.1.10 on 2023-08-28 07:56

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import orders.models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='DeliveryMethod',
            fields=[
                ('id', models.CharField(max_length=100, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, verbose_name='Name')),
            ],
            options={
                'verbose_name': 'Delivery method',
                'verbose_name_plural': 'Delivery methods',
            },
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=255, verbose_name='First name')),
                ('last_name', models.CharField(max_length=255, verbose_name='Last name')),
                ('middle_name', models.CharField(blank=True, max_length=255, verbose_name='Middle name')),
                ('address', models.CharField(blank=True, max_length=255, verbose_name='Address')),
                ('mobile', models.CharField(max_length=255, verbose_name='Mobile number')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
                ('comment', models.TextField(blank=True, max_length=1000, verbose_name='Comment')),
                ('decline_reason', models.TextField(blank=True, max_length=1000, verbose_name='Decline reason')),
                ('hash', models.CharField(default=orders.models._generate_hash, max_length=10, unique=True)),
                ('delivery_method', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orders.deliverymethod', verbose_name='Delivery method')),
            ],
            options={
                'verbose_name': 'Order',
                'verbose_name_plural': 'Orders',
            },
        ),
        migrations.CreateModel(
            name='OrderStatus',
            fields=[
                ('id', models.CharField(max_length=100, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, verbose_name='Name')),
                ('is_default', models.BooleanField(default=False, verbose_name='Default')),
            ],
            options={
                'verbose_name': 'Status',
                'verbose_name_plural': 'Statuses',
            },
        ),
        migrations.CreateModel(
            name='PaymentMethod',
            fields=[
                ('id', models.CharField(max_length=100, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=255, verbose_name='Name')),
            ],
            options={
                'verbose_name': 'Payment method',
                'verbose_name_plural': 'Payment methods',
            },
        ),
        migrations.CreateModel(
            name='OrderedProduct',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product_id', models.IntegerField(blank=True, null=True, verbose_name='Product ID')),
                ('product_name', models.CharField(max_length=255, verbose_name='Product name')),
                ('product_code', models.CharField(max_length=255, verbose_name='Product code')),
                ('product_price', models.FloatField(verbose_name='Product price')),
                ('product_printable_price', models.CharField(max_length=100, verbose_name='Product printable price')),
                ('product_currency', models.PositiveIntegerField(verbose_name='Product currency')),
                ('product_logo', models.ImageField(blank=True, null=True, upload_to='ordered_product_logos', verbose_name='Product logo')),
                ('qty', models.PositiveIntegerField(default=1, verbose_name='Quantity')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='orders.order', verbose_name='Order')),
            ],
            options={
                'verbose_name': 'Ordered product',
                'verbose_name_plural': 'Ordered products',
            },
        ),
        migrations.AddField(
            model_name='order',
            name='payment_method',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orders.paymentmethod', verbose_name='Payment method'),
        ),
        migrations.AddField(
            model_name='order',
            name='status',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orders.orderstatus', verbose_name='Status'),
        ),
        migrations.AddField(
            model_name='order',
            name='user',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to=settings.AUTH_USER_MODEL, verbose_name='Owner'),
        ),
    ]
