# Generated by Django 3.2.7 on 2022-01-18 14:12


# Disclaimer
# ----------
#
# Copyright (C) 2021 Helmholtz-Zentrum Hereon
# Copyright (C) 2020-2021 Helmholtz-Zentrum Geesthacht
#
# This file is part of django-academic-community and is released under the
# EUPL-1.2 license.
# See LICENSE in the root of the repository for full licensing details.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the EUROPEAN UNION PUBLIC LICENCE v. 1.2 or later
# as published by the European Commission.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# EUPL-1.2 license for more details.
#
# You should have received a copy of the EUPL-1.2 license along with this
# program. If not, see https://www.eupl.eu/.


import django.contrib.postgres.fields.ranges
import django.db.models.deletion
import djangocms_text_ckeditor.fields
from django.db import migrations, models

import academic_community.history.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("members", "0005_auto_20210528_1324"),
        ("auth", "0012_alter_user_first_name_max_length"),
    ]

    operations = [
        migrations.CreateModel(
            name="Event",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=50)),
                (
                    "slug",
                    models.SlugField(
                        help_text="The URL identifier for the event.",
                        max_length=30,
                        unique=True,
                    ),
                ),
                (
                    "abstract",
                    djangocms_text_ckeditor.fields.HTMLField(
                        blank=True,
                        help_text="Short disclaimer about the event.",
                        max_length=4000,
                        null=True,
                    ),
                ),
                (
                    "description",
                    djangocms_text_ckeditor.fields.HTMLField(
                        blank=True,
                        help_text="More details about the event.",
                        max_length=20000,
                        null=True,
                    ),
                ),
                (
                    "event_view_permission",
                    models.CharField(
                        choices=[
                            ("PUBLIC", "everyone"),
                            ("REGISTERED", "registered users"),
                            ("MEMBERS", "community members"),
                            ("PRIVATE", "private"),
                        ],
                        default="PRIVATE",
                        help_text="Who can view this event?",
                        max_length=20,
                    ),
                ),
                (
                    "view_permission",
                    models.CharField(
                        choices=[
                            ("PUBLIC", "everyone"),
                            ("REGISTERED", "registered users"),
                            ("MEMBERS", "community members"),
                            ("PRIVATE", "private"),
                        ],
                        default="PRIVATE",
                        help_text="Who can view the programm and abstracts for this event?",
                        max_length=20,
                    ),
                ),
                (
                    "time_range",
                    django.contrib.postgres.fields.ranges.DateTimeRangeField(
                        help_text="The start and end time when the event happens."
                    ),
                ),
                (
                    "registration_permission",
                    models.CharField(
                        choices=[
                            ("REGISTERED", "registered users"),
                            ("MEMBERS", "community members"),
                            ("PRIVATE", "private"),
                        ],
                        default="PRIVATE",
                        help_text="Who can register for this event? Note that you must also specify the registration range.",
                        max_length=20,
                    ),
                ),
                (
                    "registration_range",
                    django.contrib.postgres.fields.ranges.DateTimeRangeField(
                        blank=True,
                        help_text="The start and end when to open the registration. Note that you must also set the corresponding registration permission.",
                        null=True,
                    ),
                ),
                (
                    "submission_permission",
                    models.CharField(
                        choices=[
                            ("REGISTERED", "registered users"),
                            ("MEMBERS", "community members"),
                            ("PRIVATE", "private"),
                        ],
                        default="PRIVATE",
                        help_text="Who can submit abstracts for this event? Note that you must also specify the submission range.",
                        max_length=20,
                    ),
                ),
                (
                    "submission_range",
                    django.contrib.postgres.fields.ranges.DateTimeRangeField(
                        blank=True,
                        help_text="The start and end when to open and close the abstract submission. Note that you must also set the corresponding submission permission.",
                        null=True,
                    ),
                ),
                (
                    "submission_editing_end",
                    models.DateTimeField(
                        blank=True,
                        help_text="The time until when submitted contributions can be edited by the submitting authors. If this is not set, contributions can be edited until the time specified with the <i>submission range</i>.",
                        null=True,
                    ),
                ),
                (
                    "submission_closed",
                    models.BooleanField(
                        default=False,
                        help_text="Is the submission closed? This field is updated automatically from the submission_range.",
                    ),
                ),
                (
                    "registration_closed",
                    models.BooleanField(
                        default=False,
                        help_text="Is the registration closed? This field is updated automatically from the registration_range.",
                    ),
                ),
                (
                    "orga_group",
                    models.OneToOneField(
                        help_text="The representation of the `orga_team` as Django Group",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="auth.group",
                    ),
                ),
                (
                    "orga_team",
                    models.ManyToManyField(
                        help_text="Organizing programme team for this event. Members of the programme team can schedule, create and delete sessions and contributions.",
                        to="members.CommunityMember",
                    ),
                ),
            ],
            options={
                "permissions": (
                    ("schedule_session", "Can create and schedule sessions"),
                    ("submit_contribution", "Can submit a contribution"),
                    ("register_for_event", "Can register for the event"),
                ),
            },
            bases=(
                academic_community.history.models.RevisionMixin,
                models.Model,
            ),
        ),
        migrations.CreateModel(
            name="EventPluginModel",
            fields=[
                (
                    "cmsplugin_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        related_name="events_eventpluginmodel",
                        serialize=False,
                        to="cms.cmsplugin",
                    ),
                ),
                (
                    "show",
                    models.BooleanField(
                        default=False,
                        help_text="Should the card be expanded by default to show event links?",
                    ),
                ),
                (
                    "card_class",
                    models.CharField(
                        blank=True,
                        help_text="Additional elements for the HTML class.",
                        max_length=300,
                    ),
                ),
                (
                    "event",
                    models.ForeignKey(
                        help_text="Select the event you want to display.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="events.event",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("cms.cmsplugin",),
        ),
    ]
