# Generated by Django 4.1.7 on 2023-04-17 15:37

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
    dependencies = [
        ("diop", "0007_deliverygroup_access_users"),
    ]

    operations = [
        migrations.CreateModel(
            name="Session",
            fields=[
                (
                    "uid",
                    models.BigIntegerField(
                        help_text="Citrix:Uid (session identifier)",
                        primary_key=True,
                        serialize=False,
                        verbose_name="Session UID",
                    ),
                ),
                (
                    "t_start",
                    models.DateTimeField(
                        help_text="Citrix:StartTime (session start timestamp)",
                        verbose_name="Start Time",
                    ),
                ),
                (
                    "t_end",
                    models.DateTimeField(
                        blank=True,
                        help_text="Timestamp when the end of the session was detected first.",
                        null=True,
                        verbose_name="End Time",
                    ),
                ),
                (
                    "fqdn",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="diop.machine",
                        verbose_name="Host Name (FQDN)",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="User associated to the session, can be empty!",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="diop.user",
                        verbose_name="User",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="SessionProperties",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "t_change",
                    models.DateTimeField(
                        help_text="Citrix:SessionStateChangeTime",
                        verbose_name="State Change Time",
                    ),
                ),
                (
                    "state",
                    models.CharField(max_length=16, verbose_name="Session State"),
                ),
                (
                    "client_address",
                    models.CharField(
                        help_text="IP address of the client currently (or last) connected.",
                        max_length=46,
                        verbose_name="Client IP",
                    ),
                ),
                (
                    "client_name",
                    models.CharField(
                        help_text="The name of the client currently (or last) connected.",
                        max_length=64,
                        verbose_name="Client Name",
                    ),
                ),
                (
                    "client_version",
                    models.CharField(
                        help_text="The version of the client currently (or last) connected.",
                        max_length=16,
                        verbose_name="Client Version",
                    ),
                ),
                (
                    "session",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="diop.session",
                        verbose_name="Session UID",
                    ),
                ),
            ],
            options={
                "verbose_name": "Session Properties",
                "verbose_name_plural": "Session Properties",
            },
        ),
    ]
