# Generated by Django 5.2.11 on 2026-05-19 09:27

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', '0006_propertymaintenancevisit_propertyvisitphoto'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='PropertyInspectionReport',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('report_title', models.CharField(help_text='Example: Monthly Property Inspection Report - June 2026.', max_length=255)),
                ('report_status', models.CharField(choices=[('draft', 'Draft'), ('ready_for_review', 'Ready for Review'), ('published', 'Published to Owner')], default='draft', max_length=30)),
                ('inspection_date', models.DateField(blank=True, help_text='Usually the visit date or actual inspection completion date.', null=True)),
                ('overall_condition', models.CharField(choices=[('excellent', 'Excellent'), ('good', 'Good'), ('fair', 'Fair'), ('needs_attention', 'Needs Attention'), ('critical', 'Critical'), ('not_applicable', 'Not Applicable')], default='good', max_length=40)),
                ('cleanliness_status', models.CharField(choices=[('excellent', 'Excellent'), ('good', 'Good'), ('fair', 'Fair'), ('needs_attention', 'Needs Attention'), ('critical', 'Critical'), ('not_applicable', 'Not Applicable')], default='not_applicable', max_length=40)),
                ('garden_status', models.CharField(choices=[('excellent', 'Excellent'), ('good', 'Good'), ('fair', 'Fair'), ('needs_attention', 'Needs Attention'), ('critical', 'Critical'), ('not_applicable', 'Not Applicable')], default='not_applicable', max_length=40)),
                ('security_status', models.CharField(choices=[('excellent', 'Excellent'), ('good', 'Good'), ('fair', 'Fair'), ('needs_attention', 'Needs Attention'), ('critical', 'Critical'), ('not_applicable', 'Not Applicable')], default='not_applicable', max_length=40)),
                ('utility_status', models.CharField(choices=[('excellent', 'Excellent'), ('good', 'Good'), ('fair', 'Fair'), ('needs_attention', 'Needs Attention'), ('critical', 'Critical'), ('not_applicable', 'Not Applicable')], default='not_applicable', max_length=40)),
                ('structural_status', models.CharField(choices=[('excellent', 'Excellent'), ('good', 'Good'), ('fair', 'Fair'), ('needs_attention', 'Needs Attention'), ('critical', 'Critical'), ('not_applicable', 'Not Applicable')], default='not_applicable', max_length=40)),
                ('issues_found', models.TextField(blank=True, help_text='Describe any issues, defects, concerns, or unusual observations identified during inspection.')),
                ('recommendations', models.TextField(blank=True, help_text='Recommended follow-up actions, further checks, repairs, or maintenance improvements.')),
                ('urgent_action_required', models.BooleanField(default=False, help_text='Enable if immediate owner/staff attention is recommended.')),
                ('owner_visible_summary', models.TextField(blank=True, help_text='Summary that may later be shown to the property owner in the report center.')),
                ('internal_staff_note', models.TextField(blank=True, help_text='Internal note for Ensolanka staff only.')),
                ('is_published_to_owner', models.BooleanField(default=False, help_text="If enabled, this report can later be displayed in the owner's report center.")),
                ('published_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_property_inspection_reports', to=settings.AUTH_USER_MODEL)),
                ('managed_property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inspection_reports', to='property_manager_app.managedproperty')),
                ('prepared_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prepared_property_inspection_reports', to=settings.AUTH_USER_MODEL)),
                ('visit', models.OneToOneField(help_text='The maintenance visit from which this inspection report was prepared.', on_delete=django.db.models.deletion.CASCADE, related_name='inspection_report', to='property_manager_app.propertymaintenancevisit')),
            ],
            options={
                'verbose_name': 'Property Inspection Report',
                'verbose_name_plural': 'Property Inspection Reports',
                'ordering': ['-inspection_date', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='PropertyInspectionReportPhoto',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(upload_to='property_care/inspection_report_photos/', validators=[property_manager_app.models.validate_image_file])),
                ('photo_type', models.CharField(choices=[('general_condition', 'General Condition'), ('issue_evidence', 'Issue Evidence'), ('cleanliness', 'Cleanliness'), ('garden', 'Garden / Outdoor'), ('security', 'Security'), ('utilities', 'Utilities'), ('structural', 'Structural'), ('recommendation_reference', 'Recommendation Reference'), ('other', 'Other')], default='general_condition', max_length=40)),
                ('caption', models.CharField(blank=True, max_length=255)),
                ('is_owner_visible', models.BooleanField(default=True, help_text="If enabled, this photo can appear with the owner's inspection report.")),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('report', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='photos', to='property_manager_app.propertyinspectionreport')),
                ('uploaded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='inspection_report_photos_uploaded', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Property Inspection Report Photo',
                'verbose_name_plural': 'Property Inspection Report Photos',
                'ordering': ['-uploaded_at'],
            },
        ),
    ]
