# Generated by Django 3.0 on 2019-12-14 04:53

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

import djstripe.fields


class Migration(migrations.Migration):

    dependencies = [
        ("djstripe", "0010_upcominginvoice"),
    ]

    operations = [
        migrations.CreateModel(
            name="TaxRate",
            fields=[
                (
                    "djstripe_id",
                    models.BigAutoField(
                        primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("id", djstripe.fields.StripeIdField(max_length=255, unique=True)),
                (
                    "livemode",
                    models.NullBooleanField(
                        default=None,
                        help_text="Null here indicates that the livemode status is unknown or was previously unrecorded. Otherwise, this field indicates whether this record comes from Stripe test mode or live mode operation.",
                    ),
                ),
                (
                    "created",
                    djstripe.fields.StripeDateTimeField(
                        blank=True,
                        help_text="The datetime this object was created in stripe.",
                        null=True,
                    ),
                ),
                (
                    "metadata",
                    djstripe.fields.JSONField(
                        blank=True,
                        help_text="A set of key/value pairs that you can attach to an object. It can be useful for storing additional information about an object in a structured format.",
                        null=True,
                    ),
                ),
                (
                    "description",
                    models.TextField(
                        blank=True, help_text="A description of this object.", null=True
                    ),
                ),
                ("djstripe_created", models.DateTimeField(auto_now_add=True)),
                ("djstripe_updated", models.DateTimeField(auto_now=True)),
                (
                    "active",
                    models.BooleanField(
                        default=True,
                        help_text="Defaults to true. When set to false, this tax rate cannot be applied to objects in the API, but will still be applied to subscriptions and invoices that already have it set.",
                    ),
                ),
                (
                    "display_name",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.",
                        max_length=50,
                    ),
                ),
                (
                    "inclusive",
                    models.BooleanField(
                        help_text="This specifies if the tax rate is inclusive or exclusive."
                    ),
                ),
                (
                    "jurisdiction",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="The jurisdiction for the tax rate.",
                        max_length=50,
                    ),
                ),
                (
                    "percentage",
                    djstripe.fields.StripePercentField(
                        decimal_places=2,
                        help_text="This represents the tax rate percent out of 100.",
                        max_digits=5,
                        validators=[
                            django.core.validators.MinValueValidator(1),
                            django.core.validators.MaxValueValidator(100),
                        ],
                    ),
                ),
            ],
            options={"get_latest_by": "created", "abstract": False,},
        ),
        migrations.AddField(
            model_name="invoice",
            name="default_tax_rates",
            field=models.ManyToManyField(
                blank=True,
                db_table="djstripe_djstripeinvoicedefaulttaxrate",
                help_text="The tax rates applied to this invoice, if any.",
                related_name="_invoice_default_tax_rates_+",
                to="djstripe.TaxRate",
            ),
        ),
        migrations.AddField(
            model_name="invoiceitem",
            name="tax_rates",
            field=models.ManyToManyField(
                blank=True,
                db_table="djstripe_djstripeinvoiceitemtaxrate",
                help_text="The tax rates which apply to this invoice item. When set, the default_tax_rates on the invoice do not apply to this invoice item.",
                related_name="_invoiceitem_tax_rates_+",
                to="djstripe.TaxRate",
            ),
        ),
        migrations.AddField(
            model_name="subscription",
            name="default_tax_rates",
            field=models.ManyToManyField(
                blank=True,
                db_table="djstripe_djstripesubscriptiondefaulttaxrate",
                help_text="The tax rates that will apply to any subscription item that does not have tax_rates set. Invoices created will have their default_tax_rates populated from the subscription.",
                related_name="_subscription_default_tax_rates_+",
                to="djstripe.TaxRate",
            ),
        ),
        migrations.AddField(
            model_name="subscriptionitem",
            name="tax_rates",
            field=models.ManyToManyField(
                blank=True,
                db_table="djstripe_djstripesubscriptionitemtaxrate",
                help_text="The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item.",
                related_name="_subscriptionitem_tax_rates_+",
                to="djstripe.TaxRate",
            ),
        ),
        migrations.CreateModel(
            name="DjstripeUpcomingInvoiceTotalTaxAmount",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amount",
                    djstripe.fields.StripeQuantumCurrencyAmountField(
                        help_text="The amount, in cents, of the tax."
                    ),
                ),
                (
                    "inclusive",
                    models.BooleanField(
                        help_text="Whether this tax amount is inclusive or exclusive."
                    ),
                ),
                (
                    "invoice",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="djstripe.UpcomingInvoice",
                    ),
                ),
                (
                    "tax_rate",
                    models.ForeignKey(
                        help_text="The tax rate that was applied to get this tax amount.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="djstripe.TaxRate",
                    ),
                ),
            ],
            options={"unique_together": {("invoice", "tax_rate")},},
        ),
        migrations.CreateModel(
            name="DjstripeInvoiceTotalTaxAmount",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amount",
                    djstripe.fields.StripeQuantumCurrencyAmountField(
                        help_text="The amount, in cents, of the tax."
                    ),
                ),
                (
                    "inclusive",
                    models.BooleanField(
                        help_text="Whether this tax amount is inclusive or exclusive."
                    ),
                ),
                (
                    "invoice",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="total_tax_amounts",
                        to="djstripe.Invoice",
                    ),
                ),
                (
                    "tax_rate",
                    models.ForeignKey(
                        help_text="The tax rate that was applied to get this tax amount.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="djstripe.TaxRate",
                    ),
                ),
            ],
            options={"unique_together": {("invoice", "tax_rate")},},
        ),
    ]
