# Generated by Django 3.1.8 on 2021-04-22 19:40


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

import academic_community.history.models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AcademicMembership",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "start_date",
                    models.DateField(
                        auto_now_add=True,
                        help_text="The date when the institution entered the community",
                        null=True,
                    ),
                ),
                (
                    "end_date",
                    models.DateField(
                        blank=True,
                        help_text="The date when the institution left the community",
                        null=True,
                    ),
                ),
            ],
            options={
                "ordering": ["member"],
                "permissions": (
                    ("end_academicmembership", "Can end academic memberships"),
                ),
            },
            bases=(
                academic_community.history.models.RevisionMixin,
                models.Model,
            ),
        ),
        migrations.CreateModel(
            name="AcademicOrganization",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="The full name of the organization",
                        max_length=255,
                    ),
                ),
                (
                    "website",
                    models.URLField(
                        blank=True,
                        help_text="The URL of the organization.",
                        max_length=300,
                        null=True,
                    ),
                ),
            ],
            options={
                "permissions": (
                    (
                        "change_academicorganization_contact",
                        "Can change the organization contact",
                    ),
                ),
            },
            bases=(
                academic_community.history.models.RevisionMixin,
                models.Model,
            ),
        ),
        migrations.CreateModel(
            name="Country",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="The full country name.", max_length=255
                    ),
                ),
                (
                    "code",
                    models.CharField(
                        help_text="The 2-character country code.",
                        max_length=2,
                        null=True,
                    ),
                ),
            ],
            options={
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="Department",
            fields=[
                (
                    "academicorganization_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="institutions.academicorganization",
                    ),
                ),
                (
                    "abbreviation",
                    models.SlugField(
                        blank=True,
                        help_text="The abbreviated name of the organization.",
                        max_length=20,
                        null=True,
                    ),
                ),
            ],
            options={
                "ordering": ["parent_institution__abbreviation", "name"],
                "permissions": (
                    (
                        "change_academicorganization_contact",
                        "Can change the organization contact",
                    ),
                ),
            },
            bases=("institutions.academicorganization",),
        ),
        migrations.CreateModel(
            name="Institution",
            fields=[
                (
                    "academicorganization_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="institutions.academicorganization",
                    ),
                ),
                (
                    "abbreviation",
                    models.SlugField(
                        help_text="The abbreviated name of the organization.",
                        max_length=20,
                        unique=True,
                    ),
                ),
                (
                    "details",
                    models.CharField(
                        blank=True,
                        help_text="Any other details of the institution.",
                        max_length=4000,
                        null=True,
                    ),
                ),
                (
                    "logo",
                    models.ImageField(
                        blank=True,
                        help_text="Logo of the institution.",
                        null=True,
                        upload_to="static/images/institution-logos/",
                    ),
                ),
                (
                    "street",
                    models.CharField(
                        blank=True,
                        help_text="Street of the institution",
                        max_length=150,
                        null=True,
                    ),
                ),
                (
                    "zipcode",
                    models.CharField(
                        blank=True,
                        help_text="Zip code of the institution.",
                        max_length=12,
                        null=True,
                    ),
                ),
                (
                    "start_date",
                    models.DateField(
                        auto_now_add=True,
                        help_text="The date when the institution entered the community.",
                        null=True,
                    ),
                ),
                (
                    "end_date",
                    models.DateField(
                        blank=True,
                        help_text="The date when the institution left the community.",
                        null=True,
                    ),
                ),
                (
                    "last_modification_date",
                    models.DateField(
                        auto_now=True,
                        help_text="Date of the last update to the institution record.",
                    ),
                ),
            ],
            options={
                "ordering": ["abbreviation"],
                "permissions": (
                    (
                        "change_academicorganization_contact",
                        "Can change the organization contact",
                    ),
                ),
            },
            bases=("institutions.academicorganization",),
        ),
        migrations.CreateModel(
            name="Unit",
            fields=[
                (
                    "academicorganization_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="institutions.academicorganization",
                    ),
                ),
                (
                    "abbreviation",
                    models.SlugField(
                        blank=True,
                        help_text="The abbreviated name of the organization.",
                        max_length=20,
                        null=True,
                    ),
                ),
            ],
            options={
                "ordering": [
                    "parent_department__parent_institution__abbreviation",
                    "parent_department__name",
                    "name",
                ],
                "permissions": (
                    (
                        "change_academicorganization_contact",
                        "Can change the organization contact",
                    ),
                ),
            },
            bases=("institutions.academicorganization",),
        ),
        migrations.CreateModel(
            name="City",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="The city name.", max_length=50
                    ),
                ),
                (
                    "country",
                    models.ForeignKey(
                        help_text="The country of the city.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="institutions.country",
                    ),
                ),
            ],
            options={
                "ordering": ["name", "country__code"],
            },
        ),
    ]
