# Generated by Django 3.2.15 on 2022-11-07 13:48

import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("sessions", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("notifications", "0006_remove_uuid_null"),
    ]

    operations = [
        migrations.CreateModel(
            name="SessionAvailability",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "last_activity",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        help_text="Last activity of the session.",
                    ),
                ),
                (
                    "last_ping",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time of the last ping to the session",
                        null=True,
                    ),
                ),
                (
                    "last_pong",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time of the last pong to the session",
                        null=True,
                    ),
                ),
                (
                    "availability",
                    models.CharField(
                        choices=[
                            ("ONLINE", "🟢 Online"),
                            ("AWAY", "🟡 Away"),
                            ("DONOTDISTURB", "🔴 Do Not Disturb"),
                            ("OFFLINE", "⚪ Offline"),
                            ("DISABLED", " Disabled"),
                        ],
                        default="ONLINE",
                        help_text="Your availability",
                        max_length=20,
                    ),
                ),
                (
                    "session",
                    models.OneToOneField(
                        help_text="The browser session.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="sessions.session",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="The user of the session",
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="SessionConnection",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "channel_name",
                    models.CharField(
                        help_text="The name of the channel",
                        max_length=300,
                        unique=True,
                    ),
                ),
                (
                    "session_availability",
                    models.ForeignKey(
                        help_text="The browser session.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="notifications.sessionavailability",
                    ),
                ),
                (
                    "last_pong",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time of the last pong to the connection",
                        null=True,
                    ),
                ),
            ],
        ),
    ]
