# Generated by Django 5.1.5 on 2025-02-18 02:35

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='SystemTag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tags', models.CharField(blank=True, default='', help_text='This is the tag', max_length=255, null=True, verbose_name='tags')),
                ('slug', models.SlugField(allow_unicode=True, editable=False, max_length=100, unique=True, verbose_name='slug')),
            ],
            options={
                'verbose_name': 'System Tag',
                'verbose_name_plural': 'System Tags',
            },
        ),
        migrations.CreateModel(
            name='TaggedFieldModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('model_name', models.CharField(editable=False, max_length=128)),
                ('model_verbose_name', models.CharField(editable=False, max_length=128)),
                ('field_name', models.CharField(editable=False, max_length=128)),
                ('field_verbose_name', models.CharField(editable=False, max_length=128)),
                ('tag_type', models.CharField(default='user', editable=False, help_text="This is the tag type, default is 'user'.", max_length=20, verbose_name='tags')),
                ('default_tags', models.CharField(blank=True, help_text='These are generated for each new user to get them started.', max_length=255, null=True, verbose_name='Default tags for field.')),
                ('content', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
            ],
            options={
                'verbose_name': 'Tagged Field Model',
                'verbose_name_plural': 'Tagged Field Models',
                'ordering': ['model_name', 'field_name', 'tag_type'],
            },
        ),
        migrations.CreateModel(
            name='TagMeSynchronise',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='default', max_length=255)),
                ('synchronise', models.JSONField(blank=True, default=dict, null=True)),
            ],
            options={
                'verbose_name': 'Tags Synchronised',
                'verbose_name_plural': 'Tags Synchronised',
                'constraints': [models.UniqueConstraint(fields=('name',), name='unique_tag_synchronise_name')],
            },
        ),
        migrations.CreateModel(
            name='UserTag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tags', models.CharField(blank=True, default='', help_text='This is the tag', max_length=255, null=True, verbose_name='tags')),
                ('slug', models.SlugField(allow_unicode=True, editable=False, max_length=100, unique=True, verbose_name='slug')),
                ('model_verbose_name', models.CharField(blank=True, default=None, editable=False, max_length=255, null=True, verbose_name='Model verbose')),
                ('model_name', models.CharField(blank=True, default=None, editable=False, max_length=255, null=True, verbose_name='Model name')),
                ('comment', models.CharField(blank=True, max_length=255, null=True, verbose_name='Comment')),
                ('field_name', models.CharField(blank=True, editable=False, max_length=255, null=True, verbose_name='Field name')),
                ('field_verbose_name', models.CharField(blank=True, default=None, editable=False, max_length=255, null=True, verbose_name='Field verbose')),
                ('ui_display_name', models.CharField(blank=True, help_text='This is the user customisable ui display name.', max_length=50, null=True, verbose_name='UI Display Name')),
                ('meta', models.JSONField(blank=True, default=dict, max_length=255, null=True, verbose_name='Field meta data')),
                ('tagged_field', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tagged_field', to='tag_me.taggedfieldmodel', verbose_name='Tagged Field')),
                ('user', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_tags', to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'User Tag',
                'verbose_name_plural': 'User Tags',
                'ordering': ['model_verbose_name', 'field_name', 'tags'],
            },
        ),
        migrations.AddConstraint(
            model_name='taggedfieldmodel',
            constraint=models.UniqueConstraint(fields=('content', 'model_name', 'model_verbose_name', 'field_name', 'field_verbose_name'), name='unique_tagged_field_model'),
        ),
        migrations.AddIndex(
            model_name='usertag',
            index=models.Index(fields=['user', 'tagged_field', 'tags'], name='tag_me_user_user_id_c18274_idx'),
        ),
        migrations.AddConstraint(
            model_name='usertag',
            constraint=models.UniqueConstraint(fields=('user', 'tagged_field'), name='unique_user_field_tag'),
        ),
    ]
