# Generated by Django 2.2.4 on 2019-11-11 07:31

import django.contrib.gis.db.models.fields
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('gallery', '0006_merge_20191027_1758'),
        ('location', '0021_auto_20191111_0731'),
        ('tag', '0009_auto_20191111_0731'),
        ('product', '0008_auto_20191031_1410'),
    ]

    operations = [
        migrations.CreateModel(
            name='ProductStandard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('standard_type', models.PositiveSmallIntegerField(choices=[(0, 'Appellation'), (1, 'Wine quality'), (2, 'Yard classification')], verbose_name='standard type')),
                ('coordinates', django.contrib.gis.db.models.fields.PointField(blank=True, default=None, null=True, srid=4326, verbose_name='Coordinates')),
                ('old_id', models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='old id')),
            ],
            options={
                'verbose_name': 'wine standard',
                'verbose_name_plural': 'wine standards',
            },
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('value', models.CharField(max_length=255, verbose_name='value')),
            ],
            options={
                'verbose_name': 'unit',
                'verbose_name_plural': 'units',
            },
        ),
        migrations.RemoveField(
            model_name='product',
            name='characteristics',
        ),
        migrations.RemoveField(
            model_name='product',
            name='wine_appellation',
        ),
        migrations.AddField(
            model_name='product',
            name='old_id',
            field=models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='old id'),
        ),
        migrations.AddField(
            model_name='product',
            name='old_unique_key',
            field=models.CharField(blank=True, default=None, help_text='attribute from legacy db', max_length=255, null=True, unique=True),
        ),
        migrations.AddField(
            model_name='product',
            name='state',
            field=models.PositiveIntegerField(choices=[(0, 'Published'), (1, 'Out_of_production'), (2, 'Waiting')], default=2, help_text='attribute from legacy db', verbose_name='state'),
        ),
        migrations.AddField(
            model_name='product',
            name='tags',
            field=models.ManyToManyField(related_name='products', to='tag.Tag', verbose_name='Tag'),
        ),
        migrations.AddField(
            model_name='product',
            name='vintage',
            field=models.IntegerField(blank=True, default=None, null=True, validators=[django.core.validators.MinValueValidator(1700), django.core.validators.MaxValueValidator(2100)], verbose_name='vintage year'),
        ),
        migrations.AddField(
            model_name='product',
            name='wine_sub_region',
            field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='wines', to='location.WineSubRegion', verbose_name='wine sub region'),
        ),
        migrations.AddField(
            model_name='product',
            name='wine_village',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='location.WineVillage', verbose_name='wine appellation'),
        ),
        migrations.AddField(
            model_name='producttype',
            name='tag_categories',
            field=models.ManyToManyField(related_name='product_types', to='tag.TagCategory', verbose_name='Tag'),
        ),
        migrations.AlterField(
            model_name='product',
            name='establishment',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='products', to='establishment.Establishment', verbose_name='establishment'),
        ),
        migrations.AlterField(
            model_name='product',
            name='name',
            field=models.CharField(default=None, max_length=255, null=True, verbose_name='name'),
        ),
        migrations.AlterField(
            model_name='product',
            name='product_type',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='products', to='product.ProductType', verbose_name='Type'),
        ),
        migrations.AlterField(
            model_name='product',
            name='wine_region',
            field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='wines', to='location.WineRegion', verbose_name='wine region'),
        ),
        migrations.AlterField(
            model_name='productsubtype',
            name='index_name',
            field=models.CharField(choices=[('rum', 'Rum'), ('plate', 'Plate'), ('other', 'Other')], db_index=True, max_length=50, unique=True, verbose_name='Index name'),
        ),
        migrations.AlterField(
            model_name='producttype',
            name='index_name',
            field=models.CharField(choices=[('food', 'Food'), ('wine', 'Wine'), ('liquor', 'Liquor'), ('souvenir', 'Souvenir'), ('book', 'Book')], db_index=True, max_length=50, unique=True, verbose_name='Index name'),
        ),
        migrations.CreateModel(
            name='ProductGallery',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_main', models.BooleanField(default=False, verbose_name='Is the main image')),
                ('image', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='product_gallery', to='gallery.Image', verbose_name='gallery')),
                ('product', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='product_gallery', to='product.Product', verbose_name='product')),
            ],
            options={
                'verbose_name': 'product gallery',
                'verbose_name_plural': 'product galleries',
                'unique_together': {('product', 'image'), ('product', 'is_main')},
            },
        ),
        migrations.CreateModel(
            name='ProductClassificationType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True, verbose_name='classification type')),
                ('product_sub_type', models.ForeignKey(blank=True, default=None, help_text='Legacy attribute - possible_type (product type).Product type in our case is product subtype.', null=True, on_delete=django.db.models.deletion.PROTECT, to='product.ProductSubType', verbose_name='product subtype')),
                ('product_type', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='product.ProductType', verbose_name='product type')),
            ],
            options={
                'verbose_name': 'wine classification type',
                'verbose_name_plural': 'wine classification types',
            },
        ),
        migrations.CreateModel(
            name='ProductClassification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('old_id', models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='old id')),
                ('classification_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='product.ProductClassificationType', verbose_name='classification type')),
                ('standard', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='product.ProductStandard', verbose_name='standard')),
                ('tags', models.ManyToManyField(related_name='product_classifications', to='tag.Tag', verbose_name='Tag')),
            ],
            options={
                'verbose_name': 'product classification',
                'verbose_name_plural': 'product classifications',
            },
        ),
        migrations.AddField(
            model_name='product',
            name='classifications',
            field=models.ManyToManyField(blank=True, to='product.ProductClassification', verbose_name='classifications'),
        ),
        migrations.AddField(
            model_name='product',
            name='gallery',
            field=models.ManyToManyField(through='product.ProductGallery', to='gallery.Image'),
        ),
        migrations.AddField(
            model_name='product',
            name='standards',
            field=models.ManyToManyField(blank=True, help_text='attribute from legacy db', to='product.ProductStandard', verbose_name='standards'),
        ),
    ]
