from django.db import models
from . import TournamentSubModel
import uuid

class DrawLog(TournamentSubModel):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True)
    tournament = models.ForeignKey('Tournament', on_delete=models.SET_NULL, related_name='draw_logs', null=True)
    draw_date = models.DateTimeField()
    draw_seed = models.IntegerField()
    draw_match_index = models.IntegerField()
    draw_team_position = models.IntegerField()
    draw_type = models.IntegerField(default=0)

    def delete_dependencies(self):
        pass

    def __str__(self):
        return f'{self.draw_date}'

    def get_tournament(self): # mandatory method for TournamentSubModel
        return self.tournament
