# Generated by Django 5.2.7 on 2025-11-03 04:23

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


class Migration(migrations.Migration):

    dependencies = [
        ('users', '0004_enhanced_audit_system'),
    ]

    operations = [
        migrations.CreateModel(
            name='RoleTemplateRollbackPoint',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('rollback_id', models.CharField(help_text='Unique identifier for this rollback point', max_length=100, unique=True)),
                ('role', models.CharField(choices=[('admin', 'Administrator'), ('team_leader', 'Team Leader'), ('loan_officer', 'Loan Officer'), ('secretary', 'Secretary'), ('auditor', 'Auditor')], help_text='Role this rollback point is for', max_length=20)),
                ('template_data', models.JSONField(help_text='JSON representation of the role template at this point')),
                ('description', models.TextField(blank=True, help_text='Description of this rollback point')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('is_applied', models.BooleanField(default=False, help_text='Whether this rollback point has been applied')),
                ('applied_at', models.DateTimeField(blank=True, help_text='When this rollback was applied', null=True)),
                ('applied_by', models.ForeignKey(blank=True, help_text='User who applied this rollback', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='applied_rollback_points', to=settings.AUTH_USER_MODEL)),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this rollback point', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_rollback_points', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'role_template_rollback_points',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['role', '-created_at'], name='role_templa_role_9aa030_idx'), models.Index(fields=['rollback_id'], name='role_templa_rollbac_df61d3_idx'), models.Index(fields=['is_applied'], name='role_templa_is_appl_4dac09_idx'), models.Index(fields=['-created_at'], name='role_templa_created_93e6de_idx')],
            },
        ),
    ]
