# Generated by Django 3.1.3 on 2021-04-25 03:51


# 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 djangocms_text_ckeditor.fields
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="QuestionCategory",
            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 unique identifier for the FAQ, used for the URL",
                        max_length=20,
                        unique=True,
                    ),
                ),
                (
                    "description",
                    djangocms_text_ckeditor.fields.HTMLField(
                        blank=True,
                        help_text="Description of the category",
                        max_length=1000,
                        null=True,
                    ),
                ),
            ],
            options={
                "ordering": ["name"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="FAQ",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "question",
                    models.CharField(
                        help_text="The question that this FAQ answers.",
                        max_length=400,
                    ),
                ),
                (
                    "visibility",
                    models.CharField(
                        choices=[
                            (
                                "INTERNAL",
                                "internal - visible for each community member",
                            ),
                            ("PUBLIC", "public - visible for everyone"),
                            ("DRAFT", "draft - only visible for managers"),
                        ],
                        help_text="Visibility level for the FAQ.",
                        max_length=8,
                    ),
                ),
                (
                    "answer",
                    djangocms_text_ckeditor.fields.HTMLField(
                        help_text="The answer to the question."
                    ),
                ),
                (
                    "plain_text_answer",
                    models.TextField(
                        blank=True,
                        help_text="Plain text version of the answer, automatically generated.",
                    ),
                ),
                (
                    "categories",
                    models.ManyToManyField(
                        help_text="Under which category should we list this FAQ? There should be at least one!",
                        to="faqs.QuestionCategory",
                    ),
                ),
                (
                    "related_questions",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Other FAQs related to this question",
                        related_name="_faq_related_questions_+",
                        to="faqs.FAQ",
                    ),
                ),
            ],
        ),
    ]
