# Generated by Django 5.2.11 on 2026-05-19 10:58

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


class Migration(migrations.Migration):

    dependencies = [
        ('property_manager_app', '0007_propertyinspectionreport_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ManagedPropertyDocument',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('document_type', models.CharField(choices=[('land_plan', 'Land Plan / Survey Plan'), ('building_plan', 'Building Plan / Floor Plan'), ('ownership_proof', 'Ownership Proof / Deed Reference'), ('utility_document', 'Utility Bill / Utility Reference'), ('condition_reference', 'Property Condition Reference'), ('repair_reference', 'Repair / Maintenance Reference'), ('other', 'Other Supporting Document')], default='other', max_length=40)),
                ('title', models.CharField(help_text='Short title to identify this document.', max_length=255)),
                ('file', models.FileField(upload_to='property_care/property_documents/', validators=[property_manager_app.models.validate_property_document_file])),
                ('description', models.TextField(blank=True, help_text='Optional explanation about this document and why it is relevant.')),
                ('is_owner_visible', models.BooleanField(default=True, help_text='If enabled, this document may appear in owner-facing property records later.')),
                ('is_staff_verified', models.BooleanField(default=False, help_text='Enable after staff checks that this document is appropriate and readable.')),
                ('uploaded_by_owner', models.BooleanField(default=True, help_text='True when uploaded by the property owner; false if uploaded by staff.')),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='property_manager_app.managedproperty')),
                ('uploaded_by_staff', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='managed_property_documents_uploaded', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Managed Property Document',
                'verbose_name_plural': 'Managed Property Documents',
                'ordering': ['-uploaded_at'],
            },
        ),
    ]
