from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Accident(models.Model):
    id=models.AutoField(auto_created=True, primary_key=True)
    ac=models.CharField(max_length = 300)
    year=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    month=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    day=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    date=models.CharField(max_length=200, blank=True, null=True)
    hour=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    minute=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    address=models.CharField(max_length=100, blank=True, null=True)
    roadtype=models.CharField(max_length=100, blank=True, null=True)
    text=models.TextField(blank=True, null=True)
    dead=models.PositiveSmallIntegerField(blank=True, default=0, null=True)
    hurt=models.PositiveSmallIntegerField(blank=True, default=0, null=True)
    weather=models.CharField(max_length=100, blank=True, null=True)
    rain=models.CharField(max_length=100, blank=True, null=True)
    wind=models.CharField(max_length=100, blank=True, null=True)
    temp=models.CharField(max_length=100, blank=True, null=True)
    naturl=models.CharField(max_length=100, blank=True, null=True)
    p1_name=models.CharField(max_length=100, blank=True, null=True)
    p1_birthday=models.CharField(max_length=100, blank=True, null=True)
    p1_age=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    p1_id=models.CharField(max_length=100, blank=True, null=True)
    p1_driveyear=models.PositiveSmallIntegerField(blank=True, null=True)
    p1_type=models.CharField(max_length=100, blank=True, null=True)
    p1_dayget=models.CharField(max_length=100, blank=True, null=True)
    p1_cartype=models.CharField(max_length=50, blank=True, null=True)
    p1_numoncar=models.PositiveSmallIntegerField(blank=True, default=1, null=True)
    p1_carid=models.CharField(max_length=50, blank=True, null=True)
    p1_blame=models.CharField(max_length=100, blank=True, null=True)
    p1_sex=models.CharField(max_length=50, blank=True, null=True)
    p2_name=models.CharField(max_length=50, blank=True, null=True)
    p2_birthday=models.CharField(max_length=100, blank=True, null=True)
    p2_age=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    p2_id=models.CharField(max_length=50, blank=True, null=True)
    p2_driveyear=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    p2_type=models.CharField(max_length=50, blank=True, null=True)
    p2_dayget=models.CharField(max_length=50, blank=True, null=True)
    p2_cartype=models.CharField(max_length=50, blank=True, null=True)
    p2_numoncar=models.PositiveSmallIntegerField(blank=True, default=None, null=True,)
    p2_carid=models.CharField(max_length=50, blank=True, null=True)
    p2_blame=models.CharField(max_length=50, blank=True, null=True)
    p2_sex=models.CharField(max_length=50, blank=True, null=True)
    city=models.CharField(max_length=50, blank=True, null=True)
    lng=models.DecimalField(max_digits=18,decimal_places=15,)
    lat=models.DecimalField(max_digits=18,decimal_places=15,)
    author=models.ForeignKey(User, on_delete=models.CASCADE,related_name="accident_posts")