# Generated by ChatGPT on 2026-02-08

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


class Migration(migrations.Migration):
    dependencies = [
        ("indy_hub", "0081_character_roles"),
    ]

    operations = [
        migrations.CreateModel(
            name="CharacterOnlineStatus",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("character_id", models.BigIntegerField(unique=True)),
                ("online", models.BooleanField(default=False)),
                ("last_login", models.DateTimeField(blank=True, null=True)),
                ("last_logout", models.DateTimeField(blank=True, null=True)),
                ("logins", models.IntegerField(blank=True, null=True)),
                ("last_updated", models.DateTimeField(auto_now=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "owner_user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="character_online_statuses",
                        to="auth.user",
                    ),
                ),
            ],
            options={
                "verbose_name": "Character Online Status",
                "verbose_name_plural": "Character Online Statuses",
                "default_permissions": (),
            },
        ),
        migrations.AddIndex(
            model_name="characteronlinestatus",
            index=models.Index(
                fields=["owner_user", "character_id"],
                name="indy_hub_online_user_char_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="characteronlinestatus",
            index=models.Index(
                fields=["character_id"],
                name="indy_hub_online_char_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="characteronlinestatus",
            index=models.Index(
                fields=["last_login"],
                name="indy_hub_online_last_login_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="characteronlinestatus",
            index=models.Index(
                fields=["last_updated"],
                name="indy_hub_online_updated_idx",
            ),
        ),
    ]
