from django.db import models import uuid class TournamentPayment(models.IntegerChoices): FREE = 0, 'Gratuit' UNIT = 1, 'Unité' SUBSCRIPTION_UNIT = 2, 'Unité abonnement' UNLIMITED = 3, 'Illimité' class FederalCategory(models.IntegerChoices): MEN = 0, 'Homme' WOMEN = 1, 'Femme' MIXED = 2, 'Mixte' UNLISTED = 3, '' class FederalLevelCategory(models.IntegerChoices): UNLISTED = 0, 'Animation' P25 = 25, 'P25' P100 = 100, 'P100' P250 = 250, 'P250' P500 = 500, 'P500' P1000 = 1000, 'P1000' P1500 = 1500, 'P1500' P2000 = 2000, 'P2000' class FederalAgeCategory(models.IntegerChoices): UNLISTED = 0, '' A11_12 = 120, 'A11_12' A13_14 = 140, 'A13_14' A15_16 = 160, 'A15_16' A17_18 = 180, 'A17_18' SENIOR = 200, 'SENIOR' A45 = 450, 'A45' A55 = 550, 'A55' class FederalMatchCategory(models.IntegerChoices): TWO_SETS = 0, 'Two sets' TWO_SETS_SUPER_TIE = 1, 'Two sets super tie' TWO_SETS_FOUR_GAME = 2, 'Two sets of four games' NINE_GAMES = 3, 'Nine games' SUPER_TIE = 4, 'Super Tie-Break' MEGA_TIE = 5, 'Mega Tie-Break' TWO_SETS_DECISIVE_POINT = 6, 'Two Sets with decisive point' TWO_SETS_DECISIVE_POINT_SUPER_TIE = 7, 'Two Sets with decisive point and super tie-break' TWO_SETS_FOUR_GAME_DECISIVE_POINT = 8, 'Two sets of four games with decisive point' NINE_GAMES_DECISIVE_POINT = 9, 'Nine games with decisive point' def last_set_is_tie_break(value): if value == FederalMatchCategory.TWO_SETS_FOUR_GAME or value == FederalMatchCategory.TWO_SETS_FOUR_GAME_DECISIVE_POINT or value == FederalMatchCategory.TWO_SETS_SUPER_TIE or value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.TWO_SETS_DECISIVE_POINT_SUPER_TIE: return True else: return False def max_number_of_sets(value): if value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.NINE_GAMES or value == FederalMatchCategory.NINE_GAMES_DECISIVE_POINT: return 1 else: return 3 class ModelOperation(models.TextChoices): POST = 'POST', 'POST' PUT = 'PUT', 'PUT' DELETE = 'DELETE', 'DELETE'