# Generated by Django 5.2.9 on 2026-02-03 15:50

import django.contrib.postgres.indexes
import django.db.models.deletion
import parler.fields
import parler.models
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('product', '0026_productcategory_product_productcategory_tr16fb'),
    ]

    operations = [
        migrations.CreateModel(
            name='Attribute',
            fields=[
                ('sort_order', models.IntegerField(editable=False, null=True, verbose_name='Sort Order')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('active', models.BooleanField(default=True, verbose_name='Active')),
            ],
            options={
                'verbose_name': 'Attribute',
                'verbose_name_plural': 'Attributes',
                'ordering': ['sort_order'],
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['created_at'], name='attribute_created_at_ix'), django.contrib.postgres.indexes.BTreeIndex(fields=['updated_at'], name='attribute_updated_at_ix'), django.contrib.postgres.indexes.BTreeIndex(fields=['sort_order'], name='attribute_sort_order_ix'), django.contrib.postgres.indexes.BTreeIndex(fields=['active'], name='attribute_active_ix')],
            },
            bases=(parler.models.TranslatableModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='AttributeValue',
            fields=[
                ('sort_order', models.IntegerField(editable=False, null=True, verbose_name='Sort Order')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('active', models.BooleanField(default=True, verbose_name='Active')),
                ('attribute', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='values', to='product.attribute')),
            ],
            options={
                'verbose_name': 'Attribute Value',
                'verbose_name_plural': 'Attribute Values',
                'ordering': ['attribute', 'sort_order'],
            },
            bases=(parler.models.TranslatableModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='AttributeValueTranslation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')),
                ('value', models.CharField(max_length=255, verbose_name='Value')),
                ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='product.attributevalue')),
            ],
            options={
                'verbose_name': 'Attribute Value Translation',
                'db_table': 'product_attributevalue_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='ProductAttribute',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('attribute_value', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_attributes', to='product.attributevalue')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_attributes', to='product.product')),
            ],
            options={
                'verbose_name': 'Product Attribute',
                'verbose_name_plural': 'Product Attributes',
            },
        ),
        migrations.CreateModel(
            name='AttributeTranslation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')),
                ('name', models.CharField(max_length=100, verbose_name='Name')),
                ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='product.attribute')),
            ],
            options={
                'verbose_name': 'Attribute Translation',
                'db_table': 'product_attribute_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
                'unique_together': {('language_code', 'master')},
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
        migrations.AddIndex(
            model_name='attributevalue',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['created_at'], name='attributevalue_created_at_ix'),
        ),
        migrations.AddIndex(
            model_name='attributevalue',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['updated_at'], name='attributevalue_updated_at_ix'),
        ),
        migrations.AddIndex(
            model_name='attributevalue',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['sort_order'], name='attributevalue_sort_order_ix'),
        ),
        migrations.AddIndex(
            model_name='attributevalue',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['attribute'], name='attribute_value_attribute_ix'),
        ),
        migrations.AddIndex(
            model_name='attributevalue',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['active'], name='attribute_value_active_ix'),
        ),
        migrations.AlterUniqueTogether(
            name='attributevaluetranslation',
            unique_together={('language_code', 'master')},
        ),
        migrations.AddIndex(
            model_name='productattribute',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['created_at'], name='productattribute_created_at_ix'),
        ),
        migrations.AddIndex(
            model_name='productattribute',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['updated_at'], name='productattribute_updated_at_ix'),
        ),
        migrations.AddIndex(
            model_name='productattribute',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['product'], name='product_attribute_product_ix'),
        ),
        migrations.AddIndex(
            model_name='productattribute',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['attribute_value'], name='product_attribute_value_ix'),
        ),
        migrations.AddIndex(
            model_name='productattribute',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['product', 'attribute_value'], name='product_attribute_composite_ix'),
        ),
        migrations.AlterUniqueTogether(
            name='productattribute',
            unique_together={('product', 'attribute_value')},
        ),
    ]
