# Generated by Django 5.2.6 on 2025-10-14 19:52

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='TemporaryPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                (
                    'start_datetime',
                    models.DateTimeField(
                        help_text='Date and time when the permission becomes active',
                        validators=[django_temp_permissions.validators.validate_date_not_in_past],
                    ),
                ),
                (
                    'end_datetime',
                    models.DateTimeField(
                        help_text='Date and time when the permission expires',
                        validators=[django_temp_permissions.validators.validate_date_not_in_past],
                    ),
                ),
                (
                    'notes',
                    models.TextField(
                        blank=True, default='', help_text='Optional notes about this temporary permission'
                    ),
                ),
                (
                    'permissions',
                    models.ManyToManyField(
                        help_text='The permission being granted temporarily',
                        related_name='temporary_permissions',
                        to='auth.permission',
                    ),
                ),
                (
                    'user',
                    models.ForeignKey(
                        help_text='User receiving the temporary permission',
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='temporary_permissions',
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
