
import os
import uuid

from django.conf import settings  # this is how we can retrive variables
# for the settings file
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager,
                                        PermissionsMixin)
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.translation import gettext_lazy as _
from multiselectfield import MultiSelectField
# Maneger User class is the class that provides the creation
# of user or admin and all methods out of the box
from rest_framework import exceptions
from rest_framework.authentication import TokenAuthentication

from user.custom_token import ExpiringToken


from .exercise import BaseSerie


class RoutineDay(models.Model):
    name = models.CharField(max_length=255, blank=True)
    routine = models.ForeignKey(
        'Routine', related_name='routines', on_delete=models.CASCADE)

    def sets(self):
        return SetRoutine.objects.filter(routine=self)


class Routine(models.Model):
    name = models.CharField(max_length=255)
    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             on_delete=models.CASCADE)



class SerieRoutine(BaseSerie):
    father_set = models.ForeignKey(
        'SetRoutine', on_delete=models.CASCADE, related_name='series')



class SetRoutine(models.Model):
    exercise = models.ForeignKey(
        'Exercise', on_delete=models.CASCADE)
    routine = models.ForeignKey(
        'RoutineDay', on_delete=models.CASCADE)
[((25, 11, 25, 55), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((26, 14, 27, 69), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import models\n'), ((34, 11, 34, 43), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((35, 11, 36, 54), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import models\n'), ((41, 17, 42, 70), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import models\n'), ((47, 15, 48, 45), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import models\n'), ((49, 14, 50, 47), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import models\n')]