# Generated by Django 3.2.5 on 2021-08-01 08:08

import datetime
import django.contrib.postgres.fields.citext
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('shops', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('name', django.contrib.postgres.fields.citext.CICharField(max_length=16, verbose_name='name')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sub_categories', to='products.category', verbose_name='parent category')),
                ('shop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='categories', to='shops.shop', verbose_name='shop')),
            ],
            options={
                'verbose_name': 'category',
                'verbose_name_plural': 'categories',
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('name', django.contrib.postgres.fields.citext.CICharField(max_length=128, verbose_name='name')),
                ('description', models.TextField(blank=True, null=True, verbose_name='description')),
                ('image', models.ImageField(blank=True, null=True, upload_to='products/', verbose_name='image')),
                ('price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='price')),
                ('amount', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='amount')),
                ('is_hidden', models.BooleanField(default=False, verbose_name='is hidden')),
                ('is_digital', models.BooleanField(default=False, verbose_name='is digital product')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='products.category', verbose_name='category')),
                ('shop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shops.shop', verbose_name='shop')),
            ],
            options={
                'verbose_name': 'product',
                'verbose_name_plural': 'products',
            },
        ),
        migrations.CreateModel(
            name='ProductInstance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('text', models.TextField(blank=True, null=True, verbose_name='text')),
                ('is_bought', models.BooleanField(default=False, verbose_name='is bought')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product', verbose_name='product')),
            ],
            options={
                'verbose_name': 'product instance',
                'verbose_name_plural': 'product instances',
            },
        ),
        migrations.CreateModel(
            name='ProductInstanceAttachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('file', models.FileField(upload_to='attachments/', verbose_name='file')),
                ('product_instance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.productinstance', verbose_name='product instance')),
            ],
            options={
                'verbose_name': 'product instance attachment',
                'verbose_name_plural': 'product instance attachments',
            },
        ),
        migrations.CreateModel(
            name='ProductAttachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('file', models.FileField(upload_to='attachments/', verbose_name='file')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product', verbose_name='product')),
            ],
            options={
                'verbose_name': 'product attachment',
                'verbose_name_plural': 'product attachments',
            },
        ),
        migrations.CreateModel(
            name='Coupon',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('code', django.contrib.postgres.fields.citext.CICharField(max_length=16, verbose_name='code')),
                ('discount', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)], verbose_name='discount')),
                ('is_active', models.BooleanField(default=True, verbose_name='is active')),
                ('expires_in', models.DateField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(datetime.date(2021, 8, 1))], verbose_name='expires in')),
                ('products', models.ManyToManyField(to='products.Product', verbose_name='products')),
            ],
            options={
                'verbose_name': 'coupon',
                'verbose_name_plural': 'coupons',
            },
        ),
    ]
