# 実際のテーブル構造に基づいた最小限のGpsCheckinモデル
from django.contrib.gis.db import models

class GpsCheckin(models.Model):
    id = models.AutoField(primary_key=True)
    event_code = models.CharField(max_length=255, null=False, default='')
    zekken = models.CharField(max_length=20, null=True, blank=True)
    serial_number = models.CharField(max_length=20, null=True, blank=True)
    cp_number = models.CharField(max_length=20, null=True, blank=True)
    lat = models.FloatField(null=True, blank=True)
    lng = models.FloatField(null=True, blank=True)
    checkin_time = models.DateTimeField(null=True, blank=True)
    record_time = models.DateTimeField(null=True, blank=True)
    location = models.PointField(null=True, blank=True)
    mobserver_id = models.IntegerField(null=True, blank=True)
    event_id = models.BigIntegerField(null=True, blank=True)
    team_id = models.BigIntegerField(null=True, blank=True)
    checkpoint_id = models.BigIntegerField(null=True, blank=True)

    class Meta:
        db_table = 'rog_gpscheckin'
        managed = True

    def __str__(self):
        return f"GPS Checkin {self.id} - {self.zekken}"
