# Generated by Django 3.1.7 on 2021-02-27 20:06
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="Account",
            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="oprettet"),
                ),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Order",
            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="oprettet"),
                ),
                (
                    "description",
                    models.CharField(max_length=1024, verbose_name="description"),
                ),
                (
                    "price_currency",
                    djmoney.models.fields.CurrencyField(
                        choices=[("DKK", "DKK")],
                        default="XYZ",
                        editable=False,
                        max_length=3,
                    ),
                ),
                (
                    "price",
                    djmoney.models.fields.MoneyField(
                        decimal_places=2,
                        max_digits=16,
                        verbose_name="price (excl. VAT)",
                    ),
                ),
                (
                    "vat_currency",
                    djmoney.models.fields.CurrencyField(
                        choices=[("DKK", "DKK")],
                        default="XYZ",
                        editable=False,
                        max_length=3,
                    ),
                ),
                (
                    "vat",
                    djmoney.models.fields.MoneyField(
                        decimal_places=2, max_digits=16, verbose_name="VAT"
                    ),
                ),
                ("is_paid", models.BooleanField(default=False, verbose_name="is paid")),
                (
                    "account",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="accounting.account",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Order",
                "verbose_name_plural": "Orders",
            },
        ),
        migrations.CreateModel(
            name="Transaction",
            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="oprettet"),
                ),
                (
                    "amount_currency",
                    djmoney.models.fields.CurrencyField(
                        choices=[("DKK", "DKK")],
                        default="XYZ",
                        editable=False,
                        max_length=3,
                    ),
                ),
                (
                    "amount",
                    djmoney.models.fields.MoneyField(
                        decimal_places=2,
                        help_text="This will include VAT",
                        max_digits=16,
                        verbose_name="amount",
                    ),
                ),
                (
                    "description",
                    models.CharField(max_length=1024, verbose_name="description"),
                ),
                (
                    "account",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transactions",
                        to="accounting.account",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Payment",
            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="oprettet"),
                ),
                (
                    "amount_currency",
                    djmoney.models.fields.CurrencyField(
                        choices=[("DKK", "DKK")],
                        default="XYZ",
                        editable=False,
                        max_length=3,
                    ),
                ),
                (
                    "amount",
                    djmoney.models.fields.MoneyField(decimal_places=2, max_digits=16),
                ),
                (
                    "description",
                    models.CharField(max_length=1024, verbose_name="description"),
                ),
                (
                    "stripe_charge_id",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="accounting.order",
                    ),
                ),
            ],
            options={
                "verbose_name": "payment",
                "verbose_name_plural": "payments",
            },
        ),
    ]
