# Generated by Django 4.1 on 2023-03-07 19:20

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_auxiliaries.model_fields
import modelcluster.contrib.taggit
import modelcluster.fields
import wagtail.blocks.struct_block
import wagtail.fields
import wagtail_block_model_field.fields
import wagtail_switch_block.blocks
import wagtail_synopsis.blocks
import wagtail_synopsis.fields
import wagtail_synopsis.mixins
import wagtail_synopsis.models
import wagtail_synopsis.validators


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('wagtailcore', '0078_referenceindex'),
        ('contenttypes', '0002_remove_content_type_name'),
        ('officekit', '0002_add_address_formats'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Synopsis',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('static', wagtail_synopsis.fields.StaticField(blank=True, default='', max_length=20, null=True, verbose_name='')),
                ('category', models.CharField(default='', max_length=128, validators=[wagtail_synopsis.validators.validate_identifier])),
                ('rubric', models.CharField(blank=True, default='', max_length=128)),
                ('rubric_url', models.URLField(blank=True, default='', verbose_name='rubric URL')),
                ('heading', models.CharField(blank=True, default='', max_length=512)),
                ('summary', wagtail.fields.RichTextField(blank=True, default='')),
                ('visual', wagtail_block_model_field.fields.BlockModelField(wagtail_synopsis.blocks.VisualBlock(required=False), wagtail_switch_block.blocks.SwitchValue)),
                ('names', wagtail_block_model_field.fields.BlockModelField(wagtail_synopsis.blocks.NameListBlock(choices=(('author', 'Author'), ('editor', 'Editor')), default_choice='author'), wagtail.blocks.struct_block.StructValue)),
                ('external_url', models.URLField(blank=True, default='', verbose_name='external URL')),
                ('prominence_index', models.IntegerField(blank=True, default=None, null=True, validators=[django.core.validators.MinValueValidator(1)])),
                ('prominence_order', models.IntegerField(blank=True, default=None, null=True, validators=[django.core.validators.MinValueValidator(1)])),
                ('created_at', models.DateTimeField(default=None, editable=False, verbose_name='created at')),
                ('updated_at', models.DateTimeField(blank=True, default=None, editable=False, null=True, verbose_name='updated at')),
                ('metrics', models.JSONField(blank=True, default=dict, null=True)),
                ('content_type', models.ForeignKey(editable=False, on_delete=models.SET(wagtail_synopsis.models.get_default_synopsis_content_type), related_name='synopses', to='contenttypes.contenttype', verbose_name='content type')),
                ('created_by_user', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='created by user')),
            ],
            options={
                'verbose_name': 'synopsis',
                'verbose_name_plural': 'synopses',
            },
            bases=(wagtail_synopsis.mixins.SpecificMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SynopsisTag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True, verbose_name='name')),
                ('slug', models.SlugField(allow_unicode=True, max_length=100, unique=True, verbose_name='slug')),
            ],
            options={
                'verbose_name': 'synopsis tag',
                'verbose_name_plural': 'synopsis tags',
            },
        ),
        migrations.CreateModel(
            name='SynopsisTagItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content_object', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='tagged_items', to='wagtail_synopsis.synopsis')),
                ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tagged_synopsis', to='wagtail_synopsis.synopsistag')),
            ],
            options={
                'unique_together': {('content_object', 'tag')},
            },
        ),
        migrations.AddField(
            model_name='synopsis',
            name='tags',
            field=modelcluster.contrib.taggit.ClusterTaggableManager(blank=True, help_text='A comma-separated list of tags.', through='wagtail_synopsis.SynopsisTagItem', to='wagtail_synopsis.SynopsisTag', verbose_name='Tags'),
        ),
        migrations.CreateModel(
            name='PageSynopsis',
            fields=[
                ('synopsis_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtail_synopsis.synopsis')),
                ('model', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='synopsis', to='wagtailcore.page')),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
            bases=('wagtail_synopsis.synopsis',),
        ),
        migrations.CreateModel(
            name='NameInSynopsis',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('family_name', models.CharField(default='', max_length=192, verbose_name='Family Name')),
                ('given_names_and_initials', models.CharField(default='', max_length=192, verbose_name='Given Name(s) and Initial(s)')),
                ('role', django_auxiliaries.model_fields.MultipleChoiceField(blank=True, choices=[('author', 'Author'), ('editor', 'Editor')], default='author', max_length=64)),
                ('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='synopses+', to='officekit.person')),
                ('synopsis', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='name_index', to='wagtail_synopsis.synopsis')),
            ],
            options={
                'verbose_name': 'Name in Synopsis',
                'verbose_name_plural': 'Names in Synopsis',
                'ordering': ['sort_order'],
                'abstract': False,
                'unique_together': {('synopsis', 'family_name', 'given_names_and_initials')},
            },
        ),
    ]
