# Generated by Django 5.0.1 on 2024-01-25 09:27

import autoslug.fields
import django.db.models.deletion
import django_cloud_storage.storage
import django_ecommerce.models
import djmoney.models.fields
import django_cloud_thumbnails.fields
from decimal import Decimal
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('slug', autoslug.fields.AutoSlugField(blank=True, editable=True, populate_from='name', unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('seo_title', models.CharField(blank=True, max_length=60, null=True)),
                ('seo_description', models.TextField(blank=True, max_length=160, null=True)),
                ('seo_keywords', models.TextField(blank=True, max_length=255, null=True)),
                ('seo_image', django_cloud_thumbnails.fields.ImageCropField(blank=True, null=True, storage=django_cloud_storage.storage.CloudStorage, upload_to='')),
                ('seo_image_cropping', django_cloud_thumbnails.fields.ImageRatioField('seo_image', '1200x630', adapt_rotation=False, allow_full_size=False, free_crop=False, help_text=None, hide_image_field=False, size_warning=False, verbose_name='seo image cropping')),
            ],
            options={
                'verbose_name_plural': 'categories',
            },
        ),
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'verbose_name_plural': 'cities',
            },
        ),
        migrations.CreateModel(
            name='Color',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'verbose_name_plural': 'countries',
            },
        ),
        migrations.CreateModel(
            name='Discount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=False)),
                ('name', models.CharField(max_length=255)),
                ('start_date', models.DateTimeField()),
                ('end_date', models.DateTimeField()),
            ],
        ),
        migrations.CreateModel(
            name='Gender',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(blank=True, db_index=True, default=django_ecommerce.models.generate_order_code, max_length=16)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('confirmed', 'Confirmed'), ('canceled', 'Canceled'), ('sent', 'Sent'), ('returned', 'Returned'), ('delivered', 'Delivered')], default='pending', max_length=16)),
                ('email', models.EmailField(blank=True, max_length=255, null=True)),
                ('full_name', models.CharField(blank=True, max_length=255, null=True)),
                ('address', models.CharField(blank=True, max_length=255, null=True)),
                ('phone', models.CharField(blank=True, max_length=255, null=True)),
                ('city', models.CharField(blank=True, max_length=255, null=True)),
                ('country', models.CharField(blank=True, max_length=255, null=True)),
                ('zip_code', models.CharField(blank=True, max_length=255, null=True)),
                ('remark', models.TextField(blank=True, null=True)),
                ('shipping_amount_currency', djmoney.models.fields.CurrencyField(choices=[('EUR', 'EUR')], default='EUR', editable=False, max_length=3, null=True)),
                ('shipping_amount', djmoney.models.fields.MoneyField(blank=True, currency_choices=[('EUR', 'EUR')], decimal_places=2, default=Decimal('0'), default_currency='EUR', max_digits=14, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Setting',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('shipping_enabled', models.BooleanField(default=False)),
                ('shipping_amount_currency', djmoney.models.fields.CurrencyField(choices=[('EUR', 'EUR')], default='EUR', editable=False, max_length=3, null=True)),
                ('shipping_amount', djmoney.models.fields.MoneyField(blank=True, currency_choices=[('EUR', 'EUR')], decimal_places=2, default=Decimal('0'), default_currency='EUR', max_digits=14, null=True)),
                ('free_shipping_enabled', models.BooleanField(default=False)),
                ('free_shipping_min_amount_currency', djmoney.models.fields.CurrencyField(choices=[('EUR', 'EUR')], default='EUR', editable=False, max_length=3, null=True)),
                ('free_shipping_min_amount', djmoney.models.fields.MoneyField(blank=True, currency_choices=[('EUR', 'EUR')], decimal_places=2, default=Decimal('0'), default_currency='EUR', max_digits=14, null=True)),
            ],
            options={
                'verbose_name': 'Settings',
            },
        ),
        migrations.CreateModel(
            name='StockImport',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('comment', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Warehouse',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='DiscountCategory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('percentage', models.PositiveIntegerField(default=0)),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discount_categories', to='ecommerce.category')),
                ('discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='categories', to='ecommerce.discount')),
            ],
            options={
                'verbose_name_plural': 'discount categories',
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('slug', autoslug.fields.AutoSlugField(blank=True, editable=True, populate_from='name', unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('price_currency', djmoney.models.fields.CurrencyField(choices=[('EUR', 'EUR')], default='EUR', editable=False, max_length=3)),
                ('price', djmoney.models.fields.MoneyField(currency_choices=[('EUR', 'EUR')], decimal_places=2, default_currency='EUR', max_digits=14)),
                ('seo_title', models.CharField(blank=True, max_length=60, null=True)),
                ('seo_description', models.TextField(blank=True, max_length=160, null=True)),
                ('seo_keywords', models.TextField(blank=True, max_length=255, null=True)),
                ('seo_image', django_cloud_thumbnails.fields.ImageCropField(blank=True, null=True, storage=django_cloud_storage.storage.CloudStorage, upload_to='')),
                ('seo_image_cropping', django_cloud_thumbnails.fields.ImageRatioField('seo_image', '1200x630', adapt_rotation=False, allow_full_size=False, free_crop=False, help_text=None, hide_image_field=False, size_warning=False, verbose_name='seo image cropping')),
                ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='ecommerce.category')),
                ('color', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ecommerce.color')),
                ('gender', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ecommerce.gender')),
            ],
        ),
        migrations.CreateModel(
            name='DiscountProduct',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('percentage', models.PositiveIntegerField(default=0)),
                ('discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to='ecommerce.discount')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discount_products', to='ecommerce.product')),
            ],
        ),
        migrations.CreateModel(
            name='ProductImage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', django_cloud_thumbnails.fields.ImageCropField(blank=True, null=True, storage=django_cloud_storage.storage.CloudStorage, upload_to='')),
                ('cropping', django_cloud_thumbnails.fields.ImageRatioField('image', '1000x1000', adapt_rotation=False, allow_full_size=False, free_crop=False, help_text=None, hide_image_field=False, size_warning=False, verbose_name='cropping')),
                ('position', models.PositiveIntegerField(default=0)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='ecommerce.product')),
            ],
            options={
                'ordering': ['position'],
            },
        ),
        migrations.CreateModel(
            name='ProductVariant',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sku', models.CharField(max_length=255, unique=True)),
                ('name', models.CharField(max_length=255)),
                ('position', models.PositiveIntegerField(default=0)),
                ('active', models.BooleanField(default=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variants', to='ecommerce.product')),
            ],
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price_currency', djmoney.models.fields.CurrencyField(choices=[('EUR', 'EUR')], default='EUR', editable=False, max_length=3)),
                ('price', djmoney.models.fields.MoneyField(currency_choices=[('EUR', 'EUR')], decimal_places=2, default_currency='EUR', max_digits=14)),
                ('discount_percentage', models.PositiveIntegerField(blank=True, default=0, null=True)),
                ('quantity', models.PositiveIntegerField()),
                ('reserved', models.BooleanField(default=False)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='ecommerce.order')),
                ('product_variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='order_items', to='ecommerce.productvariant')),
                ('warehouse', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_items', to='ecommerce.warehouse')),
            ],
        ),
        migrations.CreateModel(
            name='Stock',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.IntegerField()),
                ('object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
                ('product_variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stock', to='ecommerce.productvariant')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stock', to='ecommerce.warehouse')),
            ],
            options={
                'verbose_name_plural': 'stock',
                'indexes': [models.Index(fields=['content_type', 'object_id'], name='ecommerce_s_content_aff7e3_idx')],
            },
        ),
    ]
