# Path: annotation_tool/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=50, unique=True)
#     creation_date = models.DateTimeField('creation date')
#     overlap = models.BooleanField(default=False)
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Wav(models.Model):
#     project = models.ForeignKey('Project', on_delete=models.CASCADE)
#     file = models.FileField(
#         upload_to=get_wav_file_path,
#         max_length=500)
#     name = models.CharField(max_length=1000)
#     upload_date = models.DateTimeField('upload date')
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Segment(models.Model):
#     wav = models.ForeignKey('Wav', on_delete=models.CASCADE)
#     start_time = models.FloatField()
#     end_time = models.FloatField()
#     name = models.CharField(max_length=1000)
#     priority = models.FloatField(default=2.0)
#     reliable = models.BooleanField(default=False)
# 
#     def get_project(self):
#         return self.wav.project
# 
#     def __str__(self):
#         return str(self.start_time) + '_' + str(self.end_time)
# 
# class Annotation(models.Model):
#     FINISHED = 'finished'
#     UNFINISHED = 'unfinished'
#     STATUS_CHOICES = (
#         (FINISHED, FINISHED),
#         (UNFINISHED, UNFINISHED)
#     )
#     segment = models.ForeignKey('Segment', on_delete=models.CASCADE)
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     name = models.CharField(max_length=1000)
#     annotation_date = models.DateTimeField('annotation date')
#     status = models.CharField(max_length=10, default=UNFINISHED, choices=STATUS_CHOICES)
# 
#     def get_project(self):
#         return self.segment.wav.project
# 
#     class Meta:
#         unique_together = ("segment", "user")
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Event(models.Model):
#     annotation = models.ForeignKey('Annotation', on_delete=models.CASCADE)
#     event_class = models.ForeignKey('Class', null=True,
#                                     on_delete=models.CASCADE)
#     start_time = models.FloatField()
#     end_time = models.FloatField()
#     color = models.CharField(max_length=50, blank=True)
#     tags = models.ManyToManyField('Tag', blank=True)
# 
#     def get_project(self):
#         return self.annotation.get_project()
# 
#     class Meta:
#         unique_together = ("annotation", "event_class", "start_time",
#                            "end_time")
# 
#     def __str__(self):
#         return str(self.id)
# 
# class Class(models.Model):
#     name = models.CharField(max_length=50, unique=True)
# 
#     class Meta:
#         ordering = ('name',)
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Tag(models.Model):
#     name = models.CharField(unique=True, max_length=50)
# 
#     @staticmethod
#     def get_tag_names():
#         return Tag.objects.values_list('name', flat=True)
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Region(models.Model):
#     annotation = models.ForeignKey('Annotation', on_delete=models.CASCADE)
#     start_time = models.FloatField()
#     end_time = models.FloatField()
#     color = models.CharField(max_length=50, blank=True)
#     tags = models.ManyToManyField('Tag', blank=True)
# 
#     def get_project(self):
#         return self.annotation.get_project()
# 
#     class Meta:
#         unique_together = ("annotation", "start_time", "end_time")
# 
#     def __str__(self):
#         return str(self.id)
# 
# class ClassProminence(models.Model):
#     VERY_LOW = 1
#     LOW = 2
#     MID = 3
#     LOUD = 4
#     VERY_LOUD = 5
#     PROMINENCE_CHOICES = (
#         (VERY_LOW, ''),
#         (LOW, ''),
#         (MID, ''),
#         (LOUD, ''),
#         (VERY_LOUD, 'Most salient')
#     )
#     region = models.ForeignKey(Region, related_name='classes')
#     class_obj = models.ForeignKey('Class')
#     prominence = models.PositiveSmallIntegerField(choices=PROMINENCE_CHOICES, blank=True, null=True)
# 
#     def __str__(self):
#         return self.class_obj.name
# 
#     class Meta:
#         ordering = ('class_obj__name',)
# 
# class Log(models.Model):
#     annotation = models.ForeignKey('Annotation', on_delete=models.CASCADE)
#     action = models.CharField(max_length=50, blank=False)
#     value = models.CharField(max_length=50, blank=True)
#     time = models.FloatField(null=False, blank=False)
# 
#     def __str__(self):
#         return self.action


from django.contrib import admin
from .models import Project, Wav, Segment, Annotation, Event, Class, Tag, Region, ClassProminence, Log


admin.site.register(Project)
admin.site.register(Wav)
admin.site.register(Segment)

# Path: annotation_tool/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=50, unique=True)
#     creation_date = models.DateTimeField('creation date')
#     overlap = models.BooleanField(default=False)
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Wav(models.Model):
#     project = models.ForeignKey('Project', on_delete=models.CASCADE)
#     file = models.FileField(
#         upload_to=get_wav_file_path,
#         max_length=500)
#     name = models.CharField(max_length=1000)
#     upload_date = models.DateTimeField('upload date')
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Segment(models.Model):
#     wav = models.ForeignKey('Wav', on_delete=models.CASCADE)
#     start_time = models.FloatField()
#     end_time = models.FloatField()
#     name = models.CharField(max_length=1000)
#     priority = models.FloatField(default=2.0)
#     reliable = models.BooleanField(default=False)
# 
#     def get_project(self):
#         return self.wav.project
# 
#     def __str__(self):
#         return str(self.start_time) + '_' + str(self.end_time)
# 
# class Annotation(models.Model):
#     FINISHED = 'finished'
#     UNFINISHED = 'unfinished'
#     STATUS_CHOICES = (
#         (FINISHED, FINISHED),
#         (UNFINISHED, UNFINISHED)
#     )
#     segment = models.ForeignKey('Segment', on_delete=models.CASCADE)
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     name = models.CharField(max_length=1000)
#     annotation_date = models.DateTimeField('annotation date')
#     status = models.CharField(max_length=10, default=UNFINISHED, choices=STATUS_CHOICES)
# 
#     def get_project(self):
#         return self.segment.wav.project
# 
#     class Meta:
#         unique_together = ("segment", "user")
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Event(models.Model):
#     annotation = models.ForeignKey('Annotation', on_delete=models.CASCADE)
#     event_class = models.ForeignKey('Class', null=True,
#                                     on_delete=models.CASCADE)
#     start_time = models.FloatField()
#     end_time = models.FloatField()
#     color = models.CharField(max_length=50, blank=True)
#     tags = models.ManyToManyField('Tag', blank=True)
# 
#     def get_project(self):
#         return self.annotation.get_project()
# 
#     class Meta:
#         unique_together = ("annotation", "event_class", "start_time",
#                            "end_time")
# 
#     def __str__(self):
#         return str(self.id)
# 
# class Class(models.Model):
#     name = models.CharField(max_length=50, unique=True)
# 
#     class Meta:
#         ordering = ('name',)
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Tag(models.Model):
#     name = models.CharField(unique=True, max_length=50)
# 
#     @staticmethod
#     def get_tag_names():
#         return Tag.objects.values_list('name', flat=True)
# 
#     def __str__(self):
#         return str(self.name)
# 
# class Region(models.Model):
#     annotation = models.ForeignKey('Annotation', on_delete=models.CASCADE)
#     start_time = models.FloatField()
#     end_time = models.FloatField()
#     color = models.CharField(max_length=50, blank=True)
#     tags = models.ManyToManyField('Tag', blank=True)
# 
#     def get_project(self):
#         return self.annotation.get_project()
# 
#     class Meta:
#         unique_together = ("annotation", "start_time", "end_time")
# 
#     def __str__(self):
#         return str(self.id)
# 
# class ClassProminence(models.Model):
#     VERY_LOW = 1
#     LOW = 2
#     MID = 3
#     LOUD = 4
#     VERY_LOUD = 5
#     PROMINENCE_CHOICES = (
#         (VERY_LOW, ''),
#         (LOW, ''),
#         (MID, ''),
#         (LOUD, ''),
#         (VERY_LOUD, 'Most salient')
#     )
#     region = models.ForeignKey(Region, related_name='classes')
#     class_obj = models.ForeignKey('Class')
#     prominence = models.PositiveSmallIntegerField(choices=PROMINENCE_CHOICES, blank=True, null=True)
# 
#     def __str__(self):
#         return self.class_obj.name
# 
#     class Meta:
#         ordering = ('class_obj__name',)
# 
# class Log(models.Model):
#     annotation = models.ForeignKey('Annotation', on_delete=models.CASCADE)
#     action = models.CharField(max_length=50, blank=False)
#     value = models.CharField(max_length=50, blank=True)
#     time = models.FloatField(null=False, blank=False)
# 
#     def __str__(self):
#         return self.action


# Path: annotation_tool/admin.py
from django.contrib import admin
from .models import Project, Wav, Segment, Annotation, Event, Class, Tag, Region, ClassProminence, Log



admin.site.register(Project)
admin.site.register(Wav)
admin.site.register(Segment)

admin.site.register(Annotation)