from django.db import models
from django.db.models.deletion import CASCADE
from django.db.models.fields import AutoField, CharField, DateField
from django.contrib.auth.models import AbstractUser

# Create your models here.

class User(models.Model):
    first_name = models.CharField(max_length=255, default="", blank=True, null=True)
    last_name = models.CharField(max_length=255, default="", blank=True, null=True)
    email = models.CharField(max_length=255, blank=True, null=True)
    last_login = models.DateTimeField(blank=True, null=True)
    is_superuser = models.IntegerField(default= 0, blank=False, null=False)
    username = models.CharField(unique=True, max_length=150)
    is_staff = models.IntegerField(default= 0, blank=False, null=False)
    is_active = models.IntegerField(default= 0, blank=False, null=False)
    date_joined = models.DateTimeField(auto_now_add=True)
    user_type_data = ((1, 'Admin'), (2, 'User'), (3, 'Driver'))
    user_type = models.IntegerField(default = 1, choices=user_type_data)
    email = models.CharField(max_length=255, blank=True, null=True)
    name = models.CharField(max_length=255, blank=True, null=True)
    password = models.CharField(max_length=255, blank=True, null=True)
    mobile = models.CharField(max_length=10, blank=True, null = True)
    profile_pic = models.ImageField(upload_to="user_profile", blank=True, null=True)
    fcm_token = models.CharField(null=True, max_length=255)


    class Meta:
        managed = True
        db_table = 'accounts_user'