# Generated by Django

from django.db import migrations, models
import django.db.models.deletion
import utilities.json


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('dcim', '__latest__'),
        ('extras', '__latest__'),
    ]

    operations = [
        migrations.CreateModel(
            name='MaintenancePlan',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('maintenance_type', models.CharField(choices=[('preventive', 'Preventive'), ('corrective', 'Corrective')], default='preventive', max_length=20)),
                ('frequency_days', models.PositiveIntegerField(help_text='Frequency in days')),
                ('last_executed', models.DateTimeField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='maintenance_plans', to='dcim.device')),
            ],
            options={
                'ordering': ['device', 'name'],
            },
        ),
        migrations.CreateModel(
            name='MaintenanceExecution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
                ('scheduled_date', models.DateTimeField()),
                ('completed_date', models.DateTimeField(blank=True, null=True)),
                ('status', models.CharField(choices=[('scheduled', 'Scheduled'), ('in_progress', 'In Progress'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='scheduled', max_length=20)),
                ('notes', models.TextField(blank=True)),
                ('technician', models.CharField(blank=True, max_length=100)),
                ('completed', models.BooleanField(default=False)),
                ('maintenance_plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='executions', to='netbox_maintenance_device.maintenanceplan')),
            ],
            options={
                'ordering': ['-scheduled_date'],
            },
        ),
    ]
