# Generated by Django 4.2.14 on 2024-07-16 09:17

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


class Migration(migrations.Migration):

    replaces = [
        ('adminalerts', '0001_initial'),
        ('adminalerts', '0002_adminalert_user'),
        ('adminalerts', '0003_auto_20180802_1558'),
        ('adminalerts', '0004_rename_uuid'),
        ('adminalerts', '0005_update_uuid'),
        ('adminalerts', '0006_adminalert_require_auth'),
    ]

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='AdminAlert',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name='ID',
                    ),
                ),
                (
                    'message',
                    models.CharField(
                        help_text='Alert message to be shown for users',
                        max_length=255,
                    ),
                ),
                (
                    'description',
                    markupfield.fields.MarkupField(
                        blank=True,
                        help_text='Full description of alert (optional, will '
                        'be shown on a separate page)',
                        null=True,
                        rendered_field=True,
                    ),
                ),
                (
                    'date_created',
                    models.DateTimeField(
                        auto_now_add=True, help_text='Alert creation timestamp'
                    ),
                ),
                (
                    'date_expire',
                    models.DateTimeField(
                        help_text='Alert expiration timestamp'
                    ),
                ),
                (
                    'active',
                    models.BooleanField(
                        default=True,
                        help_text='Alert status (for disabling the alert '
                        'before expiration)',
                    ),
                ),
                (
                    'sodar_uuid',
                    models.UUIDField(
                        default=uuid.uuid4,
                        help_text='Adminalerts SODAR UUID',
                        unique=True,
                    ),
                ),
                (
                    'user',
                    models.ForeignKey(
                        help_text='Superuser who has set the alert',
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='alerts',
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    '_description_rendered',
                    models.TextField(editable=False, null=True),
                ),
                (
                    'description_markup_type',
                    models.CharField(
                        choices=[
                            ('', '--'),
                            ('html', 'HTML'),
                            ('plain', 'Plain'),
                            ('markdown', 'Markdown'),
                            ('restructuredtext', 'Restructured Text'),
                        ],
                        default='markdown',
                        editable=False,
                        max_length=30,
                    ),
                ),
                (
                    'require_auth',
                    models.BooleanField(
                        default=True,
                        help_text='Require authorization to view alert',
                    ),
                ),
            ],
        ),
    ]
