# Generated by Django 4.2.1 on 2023-11-10 17:53

import c3nav.mapdata.fields
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
    dependencies = [
        ("mapdata", "0086_django_4_0"),
    ]

    operations = [
        migrations.CreateModel(
            name="RangingBeacon",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "import_tag",
                    models.CharField(
                        blank=True, max_length=32, null=True, verbose_name="import tag"
                    ),
                ),
                (
                    "geometry",
                    c3nav.mapdata.fields.GeometryField(default=None, geomtype="point"),
                ),
                (
                    "bssid",
                    models.CharField(
                        max_length=17,
                        unique=True,
                        validators=[
                            django.core.validators.RegexValidator(
                                code="invalid_bssid",
                                message="Must be a lower-case bssid",
                                regex="^([a-f0-9]{2}:){5}[a-f0-9]{2}$",
                            )
                        ],
                        verbose_name="BSSID",
                    ),
                ),
                (
                    "altitude",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        max_digits=6,
                        validators=[
                            django.core.validators.MinValueValidator(Decimal("0"))
                        ],
                        verbose_name="altitude above ground",
                    ),
                ),
                (
                    "comment",
                    models.TextField(blank=True, null=True, verbose_name="comment"),
                ),
                (
                    "space",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="mapdata.space",
                        verbose_name="space",
                    ),
                ),
            ],
            options={
                "verbose_name": "Ranging beacon",
                "verbose_name_plural": "Ranging beacons",
                "default_related_name": "ranging_beacons",
            },
        ),
    ]
