# Generated by Django 1.10 on 2016-08-11 20:30

import django.core.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

import brouwers.forum_tools.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("albums", "0001_initial"),
        ("kits", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Categorie",
            fields=[
                ("categorie_id", models.AutoField(primary_key=True, serialize=False)),
                ("naam", models.TextField()),
            ],
            options={
                "db_table": "categorieen",
                "managed": False,
            },
        ),
        migrations.CreateModel(
            name="Fabrikant",
            fields=[
                ("fabrikant_id", models.AutoField(primary_key=True, serialize=False)),
                ("naam", models.TextField()),
            ],
            options={
                "db_table": "fabrikanten",
                "managed": False,
            },
        ),
        migrations.CreateModel(
            name="Kit",
            fields=[
                ("kit_id", models.AutoField(primary_key=True, serialize=False)),
                ("modelnaam", models.TextField()),
                ("type", models.TextField()),
                ("schaal", models.SmallIntegerField()),
                ("moeilijkheid", models.IntegerField()),
                ("foto", models.TextField(blank=True, null=True)),
                ("te_koop", models.CharField(max_length=3)),
                ("url_shop", models.TextField(blank=True, null=True)),
                ("datum", models.DateTimeField()),
                ("bouwbeschrijving", models.TextField()),
            ],
            options={
                "db_table": "kits",
                "managed": False,
            },
        ),
        migrations.CreateModel(
            name="Review",
            fields=[
                ("review_id", models.AutoField(primary_key=True, serialize=False)),
                ("commentaar", models.TextField()),
                ("url_bouwverslag_mb", models.TextField(blank=True, null=True)),
                ("url_album", models.TextField(blank=True, null=True)),
                ("url_bouwverslag_twenot", models.TextField(blank=True, null=True)),
                ("pluspunten", models.TextField(blank=True, null=True)),
                ("minpunten", models.TextField(blank=True, null=True)),
                ("indruk", models.IntegerField()),
                ("datum", models.DateTimeField()),
            ],
            options={
                "db_table": "reviews",
                "managed": False,
            },
        ),
        migrations.CreateModel(
            name="Reviewer",
            fields=[
                ("reviewer_id", models.AutoField(primary_key=True, serialize=False)),
                ("naam", models.TextField()),
                ("emailadres", models.TextField()),
            ],
            options={
                "db_table": "reviewers",
                "managed": False,
            },
        ),
        migrations.CreateModel(
            name="Uitbreiding",
            fields=[
                ("uitbreiding_id", models.AutoField(primary_key=True, serialize=False)),
                ("naam", models.TextField()),
                ("fabrikantnaam", models.TextField()),
            ],
            options={
                "db_table": "uitbreidingen",
                "managed": False,
            },
        ),
        migrations.CreateModel(
            name="KitReview",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "legacy_id",
                    models.IntegerField(blank=True, db_index=True, null=True),
                ),
                (
                    "raw_text",
                    models.TextField(
                        help_text="This is your review. You can use BBCode here.",
                        verbose_name="review",
                    ),
                ),
                (
                    "html",
                    models.TextField(
                        blank=True, help_text="raw_text with BBCode rendered as html"
                    ),
                ),
                (
                    "topic",
                    brouwers.forum_tools.fields.ForumToolsIDField(
                        blank=True,
                        help_text="ID of the topic on Modelbrouwers.",
                        null=True,
                        type="topic",
                        verbose_name="topic",
                    ),
                ),
                (
                    "external_topic_url",
                    models.URLField(
                        blank=True,
                        help_text="URL to the topic not hosted on Modelbrouwers",
                        verbose_name="topic url",
                    ),
                ),
                (
                    "show_real_name",
                    models.BooleanField(
                        default=True,
                        help_text="Checking this option will display your real name as reviewer. Uncheck to use your nickname.",
                        verbose_name="show real name?",
                    ),
                ),
                ("submitted_on", models.DateTimeField(auto_now_add=True)),
                ("last_edited_on", models.DateTimeField(auto_now=True)),
                (
                    "album",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="albums.Album",
                        verbose_name="album",
                    ),
                ),
                (
                    "model_kit",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="kits.ModelKit"
                    ),
                ),
            ],
            options={
                "verbose_name": "kit review",
                "verbose_name_plural": "kit reviews",
            },
        ),
        migrations.CreateModel(
            name="KitReviewProperty",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=255, verbose_name="name")),
                ("description", models.TextField(blank=True)),
            ],
            options={
                "verbose_name": "kit review property",
                "verbose_name_plural": "kit review properties",
            },
        ),
        migrations.CreateModel(
            name="KitReviewPropertyRating",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "rating",
                    models.PositiveSmallIntegerField(
                        default=50,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(100),
                        ],
                        verbose_name="rating",
                    ),
                ),
                (
                    "kit_review",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ratings",
                        to="kitreviews.KitReview",
                    ),
                ),
                (
                    "prop",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kitreviews.KitReviewProperty",
                    ),
                ),
            ],
            options={
                "verbose_name": "kit review property rating",
                "verbose_name_plural": "kit review property ratings",
            },
        ),
        migrations.CreateModel(
            name="KitReviewVote",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "vote",
                    models.CharField(
                        choices=[("+", "+"), ("-", "-")],
                        db_index=True,
                        max_length=1,
                        verbose_name="vote",
                    ),
                ),
                (
                    "kit_review",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kitreviews.KitReview",
                    ),
                ),
                (
                    "voter",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "kit review vote",
                "verbose_name_plural": "kit review votes",
            },
        ),
        migrations.AddField(
            model_name="kitreview",
            name="properties",
            field=models.ManyToManyField(
                blank=True,
                related_name="_kitreview_properties_+",
                through="kitreviews.KitReviewPropertyRating",
                to="kitreviews.KitReviewProperty",
            ),
        ),
        migrations.AddField(
            model_name="kitreview",
            name="reviewer",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AlterUniqueTogether(
            name="kitreviewvote",
            unique_together=set([("kit_review", "voter")]),
        ),
    ]
