# Generated by Django 4.1.1 on 2023-01-27 20:32

from django.db import migrations, models
import django.db.models.deletion
import wagtail_attachments.models.attachment_fields
import wagtail_attachments.models.attachment_roles
import wagtail_attachments.models.attachments
import wagtail_attachments.models.mixins


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='AttachmentRole',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.CharField(max_length=255, unique=True, validators=[wagtail_attachments.models.attachment_roles.validate_identifier], verbose_name='Identifier')),
                ('name', models.CharField(help_text='The attachment role name.', max_length=255, unique=True, verbose_name='name')),
            ],
            options={
                'verbose_name': 'Attachment Role',
                'verbose_name_plural': 'Attachment Roles',
            },
        ),
        migrations.CreateModel(
            name='ModelAttachment',
            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)),
                ('file', wagtail_attachments.models.attachment_fields.AttachmentField(max_length=255, upload_to=wagtail_attachments.models.attachments.get_attachment_upload_path, verbose_name='file')),
                ('file_hash', models.CharField(blank=True, editable=False, max_length=48)),
                ('content_type', models.ForeignKey(editable=False, on_delete=models.SET(wagtail_attachments.models.attachments.get_default_attachment_content_type), related_name='model_attachments', to='contenttypes.contenttype', verbose_name='content type')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='wagtail_attachments.attachmentrole')),
            ],
            options={
                'verbose_name': 'Model Attachment',
                'verbose_name_plural': 'Model Attachments',
                'ordering': ['sort_order'],
                'abstract': False,
            },
            bases=(wagtail_attachments.models.mixins.SpecificMixin, models.Model),
        ),
        migrations.AddConstraint(
            model_name='attachmentrole',
            constraint=models.UniqueConstraint(fields=('identifier',), name='wagtail_attachments_attachmentrole_identifier_is_unique'),
        ),
        migrations.AddConstraint(
            model_name='attachmentrole',
            constraint=models.UniqueConstraint(fields=('name',), name='wagtail_attachments_attachmentrole_name_is_unique'),
        ),
    ]
