# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-05-16 12:49
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import item.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('category', '0001_initial'),
        ('customer', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('title', models.CharField(default=None, max_length=100)),
                ('description', models.TextField(blank=True, default=None)),
                ('item_price', models.DecimalField(decimal_places=3, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(0, 'Price must be positive number!')])),
                ('item_quantity', models.PositiveIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0, 'Quantity must be positive number!')])),
                ('item_short_desc', models.CharField(blank=True, default=None, max_length=200)),
                ('item_create_date', models.DateTimeField(auto_now_add=True, null=True)),
                ('item_update_date', models.DateTimeField(auto_now=True)),
                ('item_published', models.BooleanField(default=False)),
                ('item_metadata', models.CharField(blank=True, default=None, max_length=500)),
                ('item_category', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='category.Category')),
            ],
            options={
                'verbose_name_plural': 'Item',
                'db_table': 'Item',
            },
        ),
        migrations.CreateModel(
            name='ItemComment',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('title', models.CharField(default=None, max_length=100)),
                ('description', models.TextField(blank=True, default=None)),
                ('date_time', models.DateTimeField(auto_now_add=True)),
                ('rating', models.SmallIntegerField(default=0)),
                ('customer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='customer.Customer')),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='item.Item')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ItemField',
            fields=[
                ('field_id', models.AutoField(primary_key=True, serialize=False, unique=True)),
            ],
            options={
                'verbose_name_plural': 'ItemField',
                'db_table': 'ItemField',
            },
        ),
        migrations.CreateModel(
            name='ItemFieldItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='item.Item')),
                ('item_field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='item.ItemField')),
            ],
            options={
                'db_table': 'ItemFieldItem',
            },
        ),
        migrations.CreateModel(
            name='ItemFieldTitle',
            fields=[
                ('field_title_value_id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('field_title', models.CharField(max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='ItemFieldTypeValue',
            fields=[
                ('field_type_id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('field_type', models.CharField(blank=True, default=None, max_length=100, null=True)),
                ('field_value', models.CharField(max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='ItemImage',
            fields=[
                ('image_id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('image', models.ImageField(blank=True, default=None, upload_to=item.models.get_image_path)),
                ('image_type', models.PositiveIntegerField(default=0)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='item.Item')),
            ],
            options={
                'verbose_name_plural': 'ItemImage',
                'db_table': 'ItemImage',
            },
        ),
        migrations.AddField(
            model_name='itemfield',
            name='title',
            field=models.ForeignKey(default=None, max_length=100, on_delete=django.db.models.deletion.CASCADE, to='item.ItemFieldTitle'),
        ),
        migrations.AddField(
            model_name='itemfield',
            name='value',
            field=models.ForeignKey(default=None, max_length=100, on_delete=django.db.models.deletion.CASCADE, to='item.ItemFieldTypeValue'),
        ),
        migrations.AddField(
            model_name='item',
            name='item_fields',
            field=models.ManyToManyField(through='item.ItemFieldItem', to='item.ItemField'),
        ),
        migrations.AlterUniqueTogether(
            name='itemfielditem',
            unique_together=set([('item', 'item_field')]),
        ),
        migrations.AlterUniqueTogether(
            name='itemfield',
            unique_together=set([('value', 'title')]),
        ),
    ]
