# Generated by Django 4.2.13 on 2024-12-11 20:50

import ddcore.Serializers
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='PrivateUrl',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
                ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
                ('custom_data', models.JSONField(blank=True, encoder=ddcore.Serializers.JSONEncoder, null=True, verbose_name='Custom Data')),
                ('is_hidden', models.BooleanField(default=False, help_text='Is Object hidden?', verbose_name='Is hidden?')),
                ('is_private', models.BooleanField(default=False, help_text='Is Object private?', verbose_name='Is private?')),
                ('is_deleted', models.BooleanField(default=False, help_text='Is Object deleted?', verbose_name='Is deleted?')),
                ('deleted', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, null=True, verbose_name='deleted')),
                ('action', models.SlugField(help_text='Action', max_length=255, validators=[django.core.validators.RegexValidator('^[-_a-zA-Z0-9]+$')], verbose_name='Action')),
                ('token', models.SlugField(help_text='Token', max_length=64, validators=[django.core.validators.RegexValidator('^[-a-zA-Z0-9]+$')], verbose_name='Token')),
                ('data', models.JSONField(blank=True, encoder=ddcore.Serializers.JSONEncoder, help_text='Data', null=True, verbose_name='Data')),
                ('hits_limit', models.PositiveIntegerField(default=1, help_text='Set 0 to unlimited.', verbose_name='Hits Limit')),
                ('hit_counter', models.PositiveIntegerField(default=0, verbose_name='Hits Counter')),
                ('first_hit', models.DateTimeField(blank=True, help_text='Date of the first Hit.', null=True, verbose_name='First Hit')),
                ('last_hit', models.DateTimeField(blank=True, help_text='Date of the last Hit.', null=True, verbose_name='Last Hit')),
                ('expire', models.DateTimeField(blank=True, db_index=True, help_text='Expiration Date.', null=True, verbose_name='Expiration Date')),
                ('auto_delete', models.BooleanField(default=False, help_text='Delete Object, if it can no longer be used?', verbose_name='Auto-delete?')),
                ('created_by', models.ForeignKey(blank=True, help_text='User, created the Object.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_created_%(class)s', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User, deleted the Object.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_deleted_%(class)s', to=settings.AUTH_USER_MODEL, verbose_name='Deleted by')),
                ('modified_by', models.ForeignKey(blank=True, help_text='User, modified the Object.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_modified_%(class)s', to=settings.AUTH_USER_MODEL, verbose_name='Modified by')),
                ('user', models.ForeignKey(blank=True, help_text='User', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='shared_private_urls', to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'private url',
                'verbose_name_plural': 'private urls',
                'ordering': ('-created',),
                'unique_together': {('action', 'token')},
            },
        ),
    ]
