from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Stewardship",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("platform", models.CharField(default="telegram", max_length=20)),
                ("user_id", models.CharField(max_length=64)),
                ("bot_name", models.CharField(max_length=80)),
                ("status", models.CharField(choices=[("awaiting_location", "Awaiting location"), ("awaiting_target", "Awaiting target bot"), ("active", "Active"), ("expired", "Expired")], default="awaiting_location", max_length=32)),
                ("geohash", models.CharField(blank=True, max_length=12, null=True)),
                ("lat", models.FloatField(blank=True, null=True)),
                ("lon", models.FloatField(blank=True, null=True)),
                ("target_bot", models.CharField(blank=True, max_length=80, null=True)),
                ("energy", models.PositiveIntegerField(default=0)),
                ("expires_at", models.DateTimeField(blank=True, null=True)),
                ("pending_until", models.DateTimeField(blank=True, null=True)),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "indexes": [
                    models.Index(fields=["platform", "user_id"], name="pxy_stewar_platform_2a65e9_idx"),
                    models.Index(fields=["geohash", "status", "expires_at"], name="pxy_stewar_geohash_626644_idx"),
                ],
                "unique_together": {("platform", "user_id")},
            },
        ),
        migrations.CreateModel(
            name="StewardBlessing",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("geohash", models.CharField(max_length=12)),
                ("target_bot", models.CharField(max_length=80)),
                ("multiplier", models.FloatField(default=2.0)),
                ("starts_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("ends_at", models.DateTimeField()),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ("steward", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="blessings", to="pxy_stewards.stewardship")),
            ],
            options={
                "indexes": [
                    models.Index(fields=["geohash", "ends_at"], name="pxy_stewar_geohash_245c81_idx"),
                    models.Index(fields=["target_bot", "ends_at"], name="pxy_stewar_target__1c2e1f_idx"),
                ],
            },
        ),
        migrations.CreateModel(
            name="StewardSignal",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("geohash", models.CharField(max_length=12)),
                ("target_bot", models.CharField(max_length=80)),
                ("kind", models.CharField(default="signal", max_length=40)),
                ("note", models.TextField(blank=True, default="")),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ("steward", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="signals", to="pxy_stewards.stewardship")),
            ],
            options={
                "indexes": [
                    models.Index(fields=["geohash", "created_at"], name="pxy_stewar_geohash_62497e_idx"),
                    models.Index(fields=["target_bot", "created_at"], name="pxy_stewar_target__73ec24_idx"),
                ],
            },
        ),
    ]
