# Generated by Django 5.0.6 on 2025-08-13 21:43

import uuid

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


class Migration(migrations.Migration):

    dependencies = [
        (
            "stiftung",
            "0002_alter_dokumentlink_options_alter_foerderung_options_and_more",
        ),
    ]

    operations = [
        migrations.CreateModel(
            name="Land",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "lfd_nr",
                    models.CharField(
                        max_length=20, unique=True, verbose_name="Lfd. Nr."
                    ),
                ),
                (
                    "ew_nummer",
                    models.CharField(
                        blank=True, max_length=50, null=True, verbose_name="EW-Nummer"
                    ),
                ),
                (
                    "amtsgericht",
                    models.CharField(max_length=100, verbose_name="Amtsgericht"),
                ),
                ("gemeinde", models.CharField(max_length=100, verbose_name="Gemeinde")),
                (
                    "gemarkung",
                    models.CharField(max_length=100, verbose_name="Gemarkung"),
                ),
                ("flur", models.CharField(max_length=50, verbose_name="Flur")),
                (
                    "flurstueck",
                    models.CharField(max_length=50, verbose_name="Flurstück"),
                ),
                (
                    "groesse_qm",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0.01)],
                        verbose_name="Größe in qm",
                    ),
                ),
                (
                    "gruenland_qm",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Grünland (qm)",
                    ),
                ),
                (
                    "acker_qm",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Acker (qm)",
                    ),
                ),
                (
                    "wald_qm",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Wald (qm)",
                    ),
                ),
                (
                    "sonstiges_qm",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Sonstiges (qm)",
                    ),
                ),
                (
                    "verpachtete_gesamtflaeche",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Verpachtete Gesamtfläche (qm)",
                    ),
                ),
                (
                    "flaeche_alte_liste",
                    models.DecimalField(
                        blank=True,
                        decimal_places=2,
                        max_digits=12,
                        null=True,
                        verbose_name="Fläche alte Liste (qm)",
                    ),
                ),
                (
                    "verp_flaeche_aktuell",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=12,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Verp. Fläche aktuell (qm)",
                    ),
                ),
                (
                    "anteil_grundsteuer",
                    models.DecimalField(
                        blank=True,
                        decimal_places=2,
                        max_digits=8,
                        null=True,
                        verbose_name="Anteil Grundsteuer (%)",
                    ),
                ),
                (
                    "anteil_lwk",
                    models.DecimalField(
                        blank=True,
                        decimal_places=2,
                        max_digits=8,
                        null=True,
                        verbose_name="Anteil LWK (%)",
                    ),
                ),
                ("aktiv", models.BooleanField(default=True, verbose_name="Aktiv")),
                (
                    "notizen",
                    models.TextField(
                        blank=True, null=True, verbose_name="Ergänzende Kommentare"
                    ),
                ),
                ("erstellt_am", models.DateTimeField(auto_now_add=True)),
                ("aktualisiert_am", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Land",
                "verbose_name_plural": "Ländereien",
                "ordering": ["gemeinde", "gemarkung", "flur", "flurstueck"],
            },
        ),
        migrations.AlterField(
            model_name="dokumentlink",
            name="kontext",
            field=models.CharField(
                choices=[
                    ("antrag", "Antrag"),
                    ("verwendungsnachweis", "Verwendungsnachweis"),
                    ("rechnung", "Rechnung"),
                    ("vertrag", "Vertrag"),
                    ("bericht", "Bericht"),
                    ("landkarte", "Landkarte"),
                    ("kataster", "Kataster"),
                    ("anderes", "Anderes"),
                ],
                default="anderes",
                max_length=30,
            ),
        ),
        migrations.CreateModel(
            name="Verpachtung",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "vertragsnummer",
                    models.CharField(
                        max_length=50, unique=True, verbose_name="Vertragsnummer"
                    ),
                ),
                ("pachtbeginn", models.DateField(verbose_name="Pachtbeginn")),
                ("pachtende", models.DateField(verbose_name="Pachtende")),
                (
                    "verlaengerung",
                    models.DateField(
                        blank=True, null=True, verbose_name="Verlängerung bis"
                    ),
                ),
                (
                    "pachtzins_pro_qm",
                    models.DecimalField(
                        decimal_places=4,
                        max_digits=8,
                        verbose_name="Pachtzins pro qm (€)",
                    ),
                ),
                (
                    "pachtzins_jaehrlich",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=12,
                        verbose_name="Jährlicher Pachtzins (€)",
                    ),
                ),
                (
                    "verpachtete_flaeche",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=12,
                        verbose_name="Verpachtete Fläche (qm)",
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("aktiv", "Aktiv"),
                            ("beendet", "Beendet"),
                            ("gekuendigt", "Gekündigt"),
                            ("verlängert", "Verlängert"),
                        ],
                        default="aktiv",
                        max_length=20,
                    ),
                ),
                (
                    "bemerkungen",
                    models.TextField(
                        blank=True, null=True, verbose_name="Ergänzende Kommentare"
                    ),
                ),
                ("erstellt_am", models.DateTimeField(auto_now_add=True)),
                ("aktualisiert_am", models.DateTimeField(auto_now=True)),
                (
                    "land",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="stiftung.land",
                        verbose_name="Land",
                    ),
                ),
                (
                    "paechter",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="stiftung.person",
                        verbose_name="Pächter",
                    ),
                ),
                (
                    "verwendungsnachweis",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="stiftung.dokumentlink",
                        verbose_name="Verwendungsnachweis",
                    ),
                ),
            ],
            options={
                "verbose_name": "Verpachtung",
                "verbose_name_plural": "Verpachtungen",
                "ordering": ["-pachtbeginn"],
            },
        ),
    ]
