# Generated by Django 6.0.1 on 2026-01-15 12:02

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('accounts', '0001_initial'),
        ('auth', '0012_alter_user_first_name_max_length'),
        ('organizations', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='user',
            name='department',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='users', to='organizations.department'),
        ),
        migrations.AddField(
            model_name='user',
            name='groups',
            field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups'),
        ),
        migrations.AddField(
            model_name='user',
            name='hospital',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='users', to='organizations.hospital'),
        ),
        migrations.AddField(
            model_name='user',
            name='user_permissions',
            field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions'),
        ),
        migrations.AddIndex(
            model_name='acknowledgementcontent',
            index=models.Index(fields=['role', 'is_active', 'order'], name='accounts_ac_role_6fe1fd_idx'),
        ),
        migrations.AddIndex(
            model_name='acknowledgementcontent',
            index=models.Index(fields=['code'], name='accounts_ac_code_48fa92_idx'),
        ),
        migrations.AddField(
            model_name='acknowledgementchecklistitem',
            name='content',
            field=models.ForeignKey(blank=True, help_text='Related content section', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checklist_items', to='accounts.acknowledgementcontent'),
        ),
        migrations.AddField(
            model_name='role',
            name='group',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='role_config', to='auth.group'),
        ),
        migrations.AddField(
            model_name='role',
            name='permissions',
            field=models.ManyToManyField(blank=True, to='auth.permission'),
        ),
        migrations.AddField(
            model_name='useracknowledgement',
            name='checklist_item',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_acknowledgements', to='accounts.acknowledgementchecklistitem'),
        ),
        migrations.AddField(
            model_name='useracknowledgement',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='acknowledgements', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='userprovisionallog',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='provisional_logs', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddIndex(
            model_name='user',
            index=models.Index(fields=['email'], name='accounts_us_email_74c8d6_idx'),
        ),
        migrations.AddIndex(
            model_name='user',
            index=models.Index(fields=['employee_id'], name='accounts_us_employe_0cbd94_idx'),
        ),
        migrations.AddIndex(
            model_name='user',
            index=models.Index(fields=['is_active', '-date_joined'], name='accounts_us_is_acti_a32178_idx'),
        ),
        migrations.AddIndex(
            model_name='acknowledgementchecklistitem',
            index=models.Index(fields=['role', 'is_active', 'order'], name='accounts_ac_role_c556c1_idx'),
        ),
        migrations.AddIndex(
            model_name='acknowledgementchecklistitem',
            index=models.Index(fields=['code'], name='accounts_ac_code_b745de_idx'),
        ),
        migrations.AddIndex(
            model_name='useracknowledgement',
            index=models.Index(fields=['user', '-acknowledged_at'], name='accounts_us_user_id_7ba948_idx'),
        ),
        migrations.AddIndex(
            model_name='useracknowledgement',
            index=models.Index(fields=['checklist_item', '-acknowledged_at'], name='accounts_us_checkli_870e26_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='useracknowledgement',
            unique_together={('user', 'checklist_item')},
        ),
        migrations.AddIndex(
            model_name='userprovisionallog',
            index=models.Index(fields=['user', '-created_at'], name='accounts_us_user_id_c488d5_idx'),
        ),
        migrations.AddIndex(
            model_name='userprovisionallog',
            index=models.Index(fields=['event_type', '-created_at'], name='accounts_us_event_t_b7f691_idx'),
        ),
    ]
