# Generated by Django 2.2.13 on 2021-03-02 20:17

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("NEMO", "0027_version_3_8_0"),
    ]

    operations = [
        migrations.CreateModel(
            name="CoreFacility",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(help_text="The name of this core facility.", max_length=200, unique=True)),
            ],
            options={
                "verbose_name_plural": "Core facilities",
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="CustomCharge",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(help_text="The name of this custom charge.", max_length=255)),
                (
                    "additional_details",
                    models.CharField(
                        blank=True, help_text="Additional details for this charge.", max_length=255, null=True
                    ),
                ),
                ("date", models.DateTimeField(help_text="The date of the custom charge.")),
                (
                    "amount",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=8,
                        help_text="The amount of the charge. Use a negative amount for adjustments.",
                    ),
                ),
                (
                    "core_facility",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="NEMO_billing.CoreFacility",
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        help_text="The person who created this charge.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="custom_charge_creator",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "customer",
                    models.ForeignKey(
                        help_text="The customer to charge.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="custom_charge_customer",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "project",
                    models.ForeignKey(
                        help_text="The project to bill for this charge.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="NEMO.Project",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="CoreRelationship",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "area",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="core_rel",
                        to="NEMO.Area",
                    ),
                ),
                (
                    "consumable",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="core_rel",
                        to="NEMO.Consumable",
                    ),
                ),
                (
                    "core_facility",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="NEMO_billing.CoreFacility"),
                ),
                (
                    "tool",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="core_rel",
                        to="NEMO.Tool",
                    ),
                ),
            ],
        ),
    ]
