from django.db import models
from datetime import datetime

class Day(models.Model):

    def __repr__(self):
        return f"Health Day: {self.pub_date}"

    def __str__(self):
        return f"Health Day: {self.pub_date}"

    class SleepQuality(models.IntegerChoices):
        POOR = 1
        OK = 2
        FAIR = 3
        GOOD = 4
        EXCELLENT = 5


    class AnxietyLevel(models.IntegerChoices):
        NORMAL = 0
        ANTSY = 1
        HIGH = 2
        FOETAL = 3

    class ExerciseLevel(models.IntegerChoices):
        SLUG = 0
        LIGHT = 1
        MODERATE = 2
        WORKOUT = 3
        STRENUOUS = 4


    class TestosteroneLevel(models.Model):
        testosterone_level = models.PositiveSmallIntegerField(
            "Testosterone test results", default=0)

    class Testopel(models.Model):
        number_of_pellets = models.PositiveSmallIntegerField(
            "Number of testopel pellets received", default=0)

    class WeighIn(models.Model):
        current_weight = models.PositiveSmallIntegerField("Current weight in pounds", 
                                                          default=0)
    class SexualFunction(models.IntegerChoices):
        NO_EJACULATION = 0
        NO_ERECTION = 1
        WEAK_ERECTION = 2
        INTERCOURSE = 3
        
    class SelfMedication(models.IntegerChoices):
        NONE = 0
        CASUAL = 1
        QUESTIONABLE = 2
        HEAVY = 3


    class OverEating(models.IntegerChoices):
        NONE = 0
        MILD = 1
        MODERATE = 2
        GLUTTONOUS = 3


    day_notes = models.TextField(max_length=500, default="")
    pub_date = models.DateTimeField("date published", default = datetime.now)
    anxiety_level = models.IntegerField(choices = AnxietyLevel.choices)
    exercise_level = models.IntegerField(choices = ExerciseLevel.choices)
    sleep_quality = models.IntegerField(choices = SleepQuality.choices)
    sexual_function = models.IntegerField(choices = SexualFunction.choices, default = SexualFunction.NO_ERECTION)
    self_medication = models.IntegerField(choices = SelfMedication.choices, default = SelfMedication.NONE)
    over_eating = models.IntegerField(choices = OverEating.choices, default = OverEating.NONE)

