from django.contrib.auth.models import AbstractUser
from django.db import models


# Create your models here.
class User(AbstractUser):
    pass


class AuthGroup(models.Model):
    name = models.CharField(unique=True, max_length=150)

    class Meta:
        managed = False
        db_table = 'auth_group'


class AuthGroupPermissions(models.Model):
    id = models.BigAutoField(primary_key=True)
    group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
    permission = models.ForeignKey('AuthPermission', models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'auth_group_permissions'
        unique_together = (('group', 'permission'),)


class AuthPermission(models.Model):
    name = models.CharField(max_length=255)
    content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING)
    codename = models.CharField(max_length=100)

    class Meta:
        managed = False
        db_table = 'auth_permission'
        unique_together = (('content_type', 'codename'),)


class Dates(models.Model):
    id = models.IntegerField(primary_key=True)
    date = models.CharField(max_length=45)

    class Meta:
        managed = False
        db_table = 'dates'


class Days(models.Model):
    days_id = models.AutoField(primary_key=True)
    day_name = models.CharField(max_length=45)

    class Meta:
        managed = False
        db_table = 'days'


class DjangoAdminLog(models.Model):
    action_time = models.DateTimeField()
    object_id = models.TextField(blank=True, null=True)
    object_repr = models.CharField(max_length=200)
    action_flag = models.PositiveSmallIntegerField()
    change_message = models.TextField()
    content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING, blank=True, null=True)
    user = models.ForeignKey('MainUser', models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'django_admin_log'


class DjangoContentType(models.Model):
    app_label = models.CharField(max_length=100)
    model = models.CharField(max_length=100)

    class Meta:
        managed = False
        db_table = 'django_content_type'
        unique_together = (('app_label', 'model'),)


class DjangoMigrations(models.Model):
    id = models.BigAutoField(primary_key=True)
    app = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    applied = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'django_migrations'


class DjangoSession(models.Model):
    session_key = models.CharField(primary_key=True, max_length=40)
    session_data = models.TextField()
    expire_date = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'django_session'


class Exercises(models.Model):
    exercises_id = models.AutoField(primary_key=True)
    exercise_name = models.CharField(max_length=255)
    muscle_group = models.ForeignKey('MuscleGroup', models.DO_NOTHING, db_column='muscle_group')

    class Meta:
        managed = False
        db_table = 'exercises'


class MainUser(models.Model):
    id = models.BigAutoField(primary_key=True)
    password = models.CharField(max_length=128)
    last_login = models.DateTimeField(blank=True, null=True)
    is_superuser = models.IntegerField()
    username = models.CharField(unique=True, max_length=150)
    first_name = models.CharField(max_length=150)
    last_name = models.CharField(max_length=150)
    email = models.CharField(max_length=254)
    is_staff = models.IntegerField()
    is_active = models.IntegerField()
    date_joined = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'main_user'


class MainUserGroups(models.Model):
    id = models.BigAutoField(primary_key=True)
    user = models.ForeignKey(MainUser, models.DO_NOTHING)
    group = models.ForeignKey(AuthGroup, models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'main_user_groups'
        unique_together = (('user', 'group'),)


class MainUserUserPermissions(models.Model):
    id = models.BigAutoField(primary_key=True)
    user = models.ForeignKey(MainUser, models.DO_NOTHING)
    permission = models.ForeignKey(AuthPermission, models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'main_user_user_permissions'
        unique_together = (('user', 'permission'),)


class MuscleGroup(models.Model):
    muscle_group_id = models.AutoField(primary_key=True)
    muscle_group_name = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = 'muscle_group'


class Users(models.Model):
    user = models.CharField(primary_key=True, max_length=30)
    password = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = 'users'


class VExercises(models.Model):
    exercise_name = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    muscle_group_name = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')

    class Meta:
        managed = False  # Created from a view. Don't remove.
        db_table = 'v_exercises'


class VWorkoutTasksAll(models.Model):
    task_id = models.IntegerField()
    user = models.CharField(max_length=30, db_collation='utf8mb4_unicode_ci')
    day_name = models.CharField(max_length=45, db_collation='utf8mb4_unicode_ci')
    week = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    exercise = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    sets_count = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    weigth = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    muscle_group_name = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    date = models.CharField(max_length=45, db_collation='utf8mb4_unicode_ci')

    class Meta:
        managed = False  # Created from a view. Don't remove.
        db_table = 'v_workout_tasks_all'


class VWorkoutTasksW1(models.Model):
    objects = models.Manager()
    task_id = models.IntegerField(primary_key=True)
    user = models.CharField(max_length=30, db_collation='utf8mb4_unicode_ci')
    day_name = models.CharField(max_length=45, db_collation='utf8mb4_unicode_ci')
    week = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    exercise = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    sets_count = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    weigth = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    muscle_group_name = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    date = models.CharField(max_length=45, db_collation='utf8mb4_unicode_ci')

    def ___str___(self):
        return self.task_id

    class Meta:
        managed = False  # Created from a view. Don't remove.
        db_table = 'v_workout_tasks_w1'


class VWorkoutTasksW2(models.Model):
    objects = models.Manager()
    task_id = models.IntegerField(primary_key=True)
    user = models.CharField(max_length=30, db_collation='utf8mb4_unicode_ci')
    day_name = models.CharField(max_length=45, db_collation='utf8mb4_unicode_ci')
    week = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    exercise = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    sets_count = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    weigth = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    muscle_group_name = models.CharField(max_length=255, db_collation='utf8mb4_unicode_ci')
    date = models.CharField(max_length=45, db_collation='utf8mb4_unicode_ci')

    def ___str___(self):
        return self.task_id

    class Meta:
        managed = False  # Created from a view. Don't remove.
        db_table = 'v_workout_tasks_w2'


class Weeks(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = 'weeks'


class WorkoutTasks(models.Model):
    task_id = models.AutoField(primary_key=True)
    user_name = models.ForeignKey(Users, models.DO_NOTHING, db_column='user_name')
    exercise = models.ForeignKey(Exercises, models.DO_NOTHING, db_column='exercise')
    sets_count = models.CharField(max_length=255)
    weigth = models.CharField(max_length=255)
    day = models.ForeignKey(Days, models.DO_NOTHING, db_column='day')
    week = models.IntegerField()
    date = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'workout_tasks'
