# Generated by Django 5.2.11 on 2026-05-17 10:20

import django.db.models.deletion
from decimal import Decimal
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('property_manager_app', '0002_managedproperty_review_status_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='MaintenanceServiceType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.SlugField(help_text='Internal unique code, e.g. inspection-visits, garden-care.', max_length=120, unique=True)),
                ('name', models.CharField(max_length=180)),
                ('category', models.CharField(choices=[('inspection', 'Inspection & Reporting'), ('cleaning', 'Cleaning & Housekeeping'), ('garden', 'Garden & Outdoor Care'), ('land_care', 'Vacant Land Care'), ('utilities', 'Utilities & Bill Handling'), ('security', 'Security & Vacancy Monitoring'), ('emergency', 'Emergency Response Support'), ('arrival_preparation', 'Arrival / Property Readiness'), ('repair_coordination', 'Repair & Maintenance Coordination'), ('management', 'General Remote Property Management'), ('other', 'Other')], max_length=40)),
                ('short_description', models.CharField(blank=True, max_length=255)),
                ('description', models.TextField(blank=True)),
                ('icon_class', models.CharField(blank=True, help_text='Optional Bootstrap icon class, e.g. bi bi-binoculars-fill.', max_length=120)),
                ('calculation_method', models.CharField(choices=[('flat_monthly', 'Flat Monthly Fee'), ('per_visit', 'Per Visit'), ('per_land_unit', 'Based on Land Size'), ('per_floor_area', 'Based on Floor Area'), ('per_building', 'Based on Number of Buildings'), ('per_room', 'Based on Room Count'), ('custom_quote', 'Custom Quote Required')], default='custom_quote', max_length=40)),
                ('base_monthly_price_usd', models.DecimalField(decimal_places=2, default=Decimal('0.00'), help_text='Optional starting monthly fee for calculator use.', max_digits=10)),
                ('price_per_unit_usd', models.DecimalField(decimal_places=2, default=Decimal('0.00'), help_text='Optional unit price used later by the calculator.', max_digits=10)),
                ('pricing_unit_label', models.CharField(blank=True, help_text='Example: per visit, per perch, per 100 sq.ft, per building.', max_length=120)),
                ('minimum_monthly_price_usd', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=10)),
                ('is_calculator_enabled', models.BooleanField(default=False, help_text='If enabled, this service can later contribute to the automated monthly estimate.')),
                ('requires_staff_quote', models.BooleanField(default=False, help_text='If true, the service should be shown as requiring review/custom quotation.')),
                ('is_active', models.BooleanField(default=True)),
                ('display_order', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Maintenance Service Type',
                'verbose_name_plural': 'Maintenance Service Types',
                'ordering': ['display_order', 'category', 'name'],
            },
        ),
        migrations.CreateModel(
            name='PropertyServiceSelection',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('frequency', models.CharField(choices=[('one_time', 'One-Time / As Needed'), ('monthly_once', 'Once per Month'), ('monthly_twice', 'Twice per Month'), ('weekly_once', 'Once per Week'), ('weekly_twice', 'Twice per Week'), ('custom', 'Custom Frequency')], default='monthly_once', max_length=30)),
                ('custom_frequency_note', models.CharField(blank=True, help_text='Used when frequency is custom.', max_length=255)),
                ('requested_visits_per_month', models.PositiveIntegerField(default=1, help_text='Optional clearer operational count for future estimation.')),
                ('owner_note', models.TextField(blank=True, help_text='Owner-specific note or expectation for this service.')),
                ('estimated_monthly_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('final_monthly_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('selection_status', models.CharField(choices=[('draft', 'Draft'), ('requested', 'Requested by Owner'), ('under_review', 'Under Review'), ('approved', 'Approved for Plan'), ('not_included', 'Not Included')], default='requested', max_length=30)),
                ('staff_note', models.TextField(blank=True, help_text='Internal staff review note for this selected service.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service_selections', to='property_manager_app.managedproperty')),
                ('service_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='property_selections', to='property_manager_app.maintenanceservicetype')),
            ],
            options={
                'verbose_name': 'Property Service Selection',
                'verbose_name_plural': 'Property Service Selections',
                'ordering': ['service_type__display_order', 'service_type__name'],
            },
        ),
        migrations.AddField(
            model_name='managedproperty',
            name='selected_services',
            field=models.ManyToManyField(blank=True, related_name='selected_for_properties', through='property_manager_app.PropertyServiceSelection', to='property_manager_app.maintenanceservicetype'),
        ),
        migrations.AddConstraint(
            model_name='propertyserviceselection',
            constraint=models.UniqueConstraint(fields=('property', 'service_type'), name='unique_service_selection_per_property'),
        ),
    ]
