# Generated by Django 2.0.5 on 2018-05-21 05:11

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name="LineItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, verbose_name="created at"
                    ),
                ),
                ("title", models.CharField(max_length=200, verbose_name="title")),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2, max_digits=10, verbose_name="amount"
                    ),
                ),
            ],
            options={
                "verbose_name": "line item",
                "verbose_name_plural": "line items",
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="Payment",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, verbose_name="created at"
                    ),
                ),
                (
                    "charged_at",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="charged at"
                    ),
                ),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2, max_digits=10, verbose_name="amount"
                    ),
                ),
                (
                    "payment_service_provider",
                    models.CharField(
                        blank=True,
                        max_length=100,
                        verbose_name="payment service provider",
                    ),
                ),
                ("email", models.EmailField(max_length=254, verbose_name="email")),
                (
                    "transaction",
                    models.TextField(blank=True, verbose_name="transaction"),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="user_payments",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="user",
                    ),
                ),
            ],
            options={
                "verbose_name": "payment",
                "verbose_name_plural": "payments",
                "ordering": ("-created_at",),
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="lineitem",
            name="payment",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="lineitems",
                to="user_payments.Payment",
                verbose_name="payment",
            ),
        ),
        migrations.AddField(
            model_name="lineitem",
            name="user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="user_lineitems",
                to=settings.AUTH_USER_MODEL,
                verbose_name="user",
            ),
        ),
    ]
