# Generated by Django 3.0.2 on 2020-04-29 19:49

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.utils.timezone import utc


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('product_management', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Address',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('address_street_name', models.CharField(max_length=256)),
                ('address_company_name', models.CharField(max_length=128)),
                ('address_house_nr', models.CharField(max_length=10)),
                ('address_region', models.CharField(max_length=128)),
                ('address_place_name', models.CharField(max_length=128)),
                ('address_phone', models.IntegerField()),
                ('address_zip_code', models.CharField(max_length=8)),
            ],
        ),
        migrations.CreateModel(
            name='Countrie',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('country_name', models.CharField(max_length=128)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_date', models.DateTimeField(default=datetime.datetime(2020, 4, 29, 19, 49, 59, 337881, tzinfo=utc))),
                ('order_required_date', models.DateField(blank=True, default=django.utils.timezone.now, null=True)),
                ('order_completed_date', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('invoice_address', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='invoice_address', to='order_management.Address')),
                ('ordered_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Shipment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('shipment_tracking_code', models.CharField(max_length=128)),
                ('shipment_date', models.DateTimeField()),
                ('shipment_of_order', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='order_management.Order')),
            ],
        ),
        migrations.CreateModel(
            name='Shipper',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('shipper_name', models.CharField(max_length=128)),
                ('shipper_tracking_url', models.URLField()),
            ],
        ),
        migrations.CreateModel(
            name='ShipmentDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('shipment_amount_included', models.FloatField()),
                ('shipment', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='order_management.Shipment')),
                ('shipment_product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='product_management.Product')),
            ],
        ),
        migrations.AddField(
            model_name='shipment',
            name='shipment_shipper',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='order_management.Shipper'),
        ),
        migrations.CreateModel(
            name='OrderDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_detail_amount', models.DecimalField(decimal_places=2, default=1, max_digits=10)),
                ('order_detail_unit_price', models.DecimalField(decimal_places=2, max_digits=10)),
                ('order_detail_discount', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('order_detail_order', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='order_management.Order')),
                ('order_detail_product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='product_management.Product')),
            ],
        ),
        migrations.AddField(
            model_name='order',
            name='schiping_with',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='order_management.Shipper'),
        ),
        migrations.AddField(
            model_name='order',
            name='shipping_address',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='shipping_address', to='order_management.Address'),
        ),
        migrations.AddField(
            model_name='address',
            name='address_county',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='order_management.Countrie'),
        ),
        migrations.AddField(
            model_name='address',
            name='address_from_user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
        ),
    ]
