# Generated by Django 5.2.11 on 2026-05-18 14:44

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

    operations = [
        migrations.CreateModel(
            name='PropertyMaintenanceVisit',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('visit_title', models.CharField(help_text='Example: Monthly Inspection Visit - June 2026.', max_length=255)),
                ('visit_type', models.CharField(choices=[('inspection', 'Inspection Visit'), ('cleaning', 'Cleaning Visit'), ('garden_care', 'Garden / Outdoor Care Visit'), ('security_check', 'Security Check'), ('utility_handling', 'Utility Handling Visit'), ('arrival_preparation', 'Arrival Preparation Visit'), ('emergency_response', 'Emergency Response Visit'), ('repair_followup', 'Repair Follow-up Visit'), ('general_visit', 'General Property Care Visit')], default='general_visit', max_length=40)),
                ('visit_status', models.CharField(choices=[('scheduled', 'Scheduled'), ('in_progress', 'In Progress'), ('completed', 'Completed'), ('cancelled', 'Cancelled'), ('rescheduled', 'Rescheduled')], default='scheduled', max_length=30)),
                ('scheduled_date', models.DateField(blank=True, null=True)),
                ('scheduled_time', models.TimeField(blank=True, null=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('visit_summary', models.TextField(blank=True, help_text='General summary of what was done during the visit.')),
                ('owner_visible_note', models.TextField(blank=True, help_text='Note that may be shown to the property owner.')),
                ('internal_note', models.TextField(blank=True, help_text='Internal staff-only operational note.')),
                ('is_owner_visible', models.BooleanField(default=False, help_text='If enabled, this visit can later appear in the owner report center.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('care_plan', models.ForeignKey(blank=True, help_text='Optional: linked finalized care plan under which this visit is performed.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='maintenance_visits', to='property_manager_app.propertycareplan')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='property_care_visits_created', to=settings.AUTH_USER_MODEL)),
                ('managed_property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='maintenance_visits', to='property_manager_app.managedproperty')),
                ('related_service_type', models.ForeignKey(blank=True, help_text='Optional: selected/final care service that this visit mainly relates to.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='maintenance_visits', to='property_manager_app.maintenanceservicetype')),
                ('visited_by', models.ForeignKey(blank=True, help_text='Staff user primarily responsible for this visit.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='property_care_visits_completed', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Property Maintenance Visit',
                'verbose_name_plural': 'Property Maintenance Visits',
                'ordering': ['-scheduled_date', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='PropertyVisitPhoto',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(upload_to='property_care/visit_photos/', validators=[property_manager_app.models.validate_image_file])),
                ('photo_type', models.CharField(choices=[('before', 'Before Visit'), ('after', 'After Visit'), ('issue', 'Issue / Concern'), ('general', 'General Property View'), ('completion_proof', 'Completion Proof'), ('other', 'Other')], default='general', max_length=30)),
                ('caption', models.CharField(blank=True, max_length=255)),
                ('is_owner_visible', models.BooleanField(default=True, help_text="If enabled, this image can appear in the owner's service tracking view.")),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('uploaded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='property_visit_photos_uploaded', to=settings.AUTH_USER_MODEL)),
                ('visit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='photos', to='property_manager_app.propertymaintenancevisit')),
            ],
            options={
                'verbose_name': 'Property Visit Photo',
                'verbose_name_plural': 'Property Visit Photos',
                'ordering': ['-uploaded_at'],
            },
        ),
    ]
