# Generated by Django 5.2.16 on 2026-08-02 05:26

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Device',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('device_id', models.CharField(max_length=64, unique=True)),
                ('name', models.CharField(blank=True, max_length=128)),
                ('api_key', models.CharField(blank=True, max_length=64)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('last_seen', models.DateTimeField(blank=True, null=True)),
            ],
            options={
                'ordering': ['-last_seen', 'device_id'],
            },
        ),
        migrations.CreateModel(
            name='LocationPoint',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('latitude', models.DecimalField(blank=True, decimal_places=7, max_digits=10, null=True)),
                ('longitude', models.DecimalField(blank=True, decimal_places=7, max_digits=10, null=True)),
                ('altitude', models.FloatField(blank=True, null=True)),
                ('speed', models.FloatField(blank=True, help_text='Speed in km/h', null=True)),
                ('satellites', models.PositiveSmallIntegerField(blank=True, null=True)),
                ('fix_valid', models.BooleanField(default=False)),
                ('chars_processed', models.PositiveIntegerField(blank=True, null=True)),
                ('gps_date', models.DateField(blank=True, null=True)),
                ('gps_time', models.TimeField(blank=True, null=True)),
                ('recorded_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now)),
                ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='tracking.device')),
            ],
            options={
                'ordering': ['-recorded_at'],
                'indexes': [models.Index(fields=['device', '-recorded_at'], name='tracking_lo_device__8685ad_idx')],
            },
        ),
    ]
