# Generated by Django 2.0.6 on 2018-06-23 19:07
from decimal import Decimal

import django.db.models.deletion
import djmoney.models.fields
from django.conf import settings
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

    initial = True

    dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]

    operations = [
        migrations.CreateModel(
            name="Membership",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(auto_now=True, verbose_name="modified"),
                ),
                (
                    "created",
                    models.DateTimeField(auto_now_add=True, verbose_name="created"),
                ),
                (
                    "can_vote",
                    models.BooleanField(
                        default=False,
                        help_text="Indicates that the user has a democratic membership of the organization.",
                        verbose_name="can vote",
                    ),
                ),
            ],
            options={
                "verbose_name": "membership",
                "verbose_name_plural": "memberships",
            },
        ),
        migrations.CreateModel(
            name="Organization",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(auto_now=True, verbose_name="modified"),
                ),
                (
                    "created",
                    models.DateTimeField(auto_now_add=True, verbose_name="created"),
                ),
                ("name", models.CharField(max_length=64, verbose_name="name")),
            ],
            options={
                "verbose_name": "organization",
                "verbose_name_plural": "organizations",
            },
        ),
        migrations.CreateModel(
            name="Subscription",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(auto_now=True, verbose_name="modified"),
                ),
                (
                    "created",
                    models.DateTimeField(auto_now_add=True, verbose_name="created"),
                ),
                (
                    "active",
                    models.BooleanField(
                        default=False,
                        help_text="Automatically set by payment system.",
                        verbose_name="active",
                    ),
                ),
                ("starts", models.DateField()),
                ("ends", models.DateField()),
                (
                    "renewed_subscription",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="membership.Subscription",
                        verbose_name="renewed subscription",
                    ),
                ),
            ],
            options={
                "verbose_name": "subscription",
                "verbose_name_plural": "subscriptions",
            },
        ),
        migrations.CreateModel(
            name="SubscriptionType",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(auto_now=True, verbose_name="modified"),
                ),
                (
                    "created",
                    models.DateTimeField(auto_now_add=True, verbose_name="created"),
                ),
                ("name", models.CharField(max_length=64, verbose_name="name")),
                (
                    "fee_currency",
                    djmoney.models.fields.CurrencyField(
                        choices=[("DKK", "DKK")],
                        default="XYZ",
                        editable=False,
                        max_length=3,
                    ),
                ),
                (
                    "fee",
                    djmoney.models.fields.MoneyField(
                        decimal_places=2, default=Decimal("0.0"), max_digits=16
                    ),
                ),
                (
                    "fee_vat_currency",
                    djmoney.models.fields.CurrencyField(
                        choices=[("DKK", "DKK")],
                        default="XYZ",
                        editable=False,
                        max_length=3,
                    ),
                ),
                (
                    "fee_vat",
                    djmoney.models.fields.MoneyField(
                        decimal_places=2, default=Decimal("0"), max_digits=16
                    ),
                ),
                (
                    "duration",
                    models.PositiveSmallIntegerField(
                        choices=[(1, "annual")], default=1, verbose_name="duration"
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="membership.Organization",
                    ),
                ),
            ],
            options={
                "verbose_name": "subscription type",
                "verbose_name_plural": "subscription types",
            },
        ),
        migrations.AddField(
            model_name="subscription",
            name="subscription_type",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="memberships",
                to="membership.SubscriptionType",
                verbose_name="subscription type",
            ),
        ),
        migrations.AddField(
            model_name="subscription",
            name="user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AddField(
            model_name="membership",
            name="organization",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to="membership.Organization",
            ),
        ),
        migrations.AddField(
            model_name="membership",
            name="user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL
            ),
        ),
    ]