# Generated by Django 5.2.9 on 2026-01-25 14:21

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='CalendarSubscriptionToken',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('caldav_path', models.CharField(help_text='CalDAV path of the calendar', max_length=512)),
                ('calendar_name', models.CharField(blank=True, default='', help_text='Display name of the calendar', max_length=255)),
                ('token', models.UUIDField(db_index=True, default=uuid.uuid4, help_text='Secret token used in the subscription URL', unique=True)),
                ('is_active', models.BooleanField(default=True, help_text='Whether this subscription token is active')),
                ('last_accessed_at', models.DateTimeField(blank=True, help_text='Last time this subscription URL was accessed', null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscription_tokens', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'calendar subscription token',
                'verbose_name_plural': 'calendar subscription tokens',
                'constraints': [models.UniqueConstraint(fields=('owner', 'caldav_path'), name='unique_token_per_owner_calendar')],
            },
        ),
    ]
