from django.db import models
from exercise.models import Exercise

# Create your models here.
class Muscle(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    name = models.CharField(null=True, blank=True, max_length=64)

    def __str__(self):
        return  self.name
    
class ExerciseMuscle(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    exercise = models.ForeignKey(
      Exercise,
      on_delete=models.CASCADE,
      related_name='exercise_muscle_exercise'
    )
    muscle = models.ForeignKey(
      Muscle,
      on_delete=models.CASCADE,
      related_name='exercise_muscle_muscle'
    )

    def __str__(self):
      return self.exercise.name + " : " + self.muscle.name