Coverage for functions \ flipdare \ generated \ shared \ model \ model_obj_type.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1#!/usr/bin/env python 

2# 

3# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

4# 

5# This file is part of Flipdare's proprietary software and contains 

6# confidential and copyrighted material. Unauthorised copying, 

7# modification, distribution, or use of this file is strictly 

8# prohibited without prior written permission from Flipdare Pty Ltd. 

9# 

10# This software includes third-party components licensed under MIT, 

11# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

12# 

13# NOTE: THIS FILE IS AUTO GENERATED. DO NOT EDIT. 

14# 

15# Generated by codegen_models.py 

16# 

17# Modify 'codegen_models.py' 

18# and re-run the script above to update. 

19# 

20 

21# pragma: no cover 

22 

23from enum import StrEnum 

24from flipdare.generated.shared.search.search_obj_type import SearchObjType 

25 

26 

27class ModelObjType(StrEnum): 

28 """Model Object Type""" 

29 

30 # Declared here so type-checkers know these attributes exist. 

31 # They are populated per-member inside __new__. 

32 _resolution_message: str 

33 _label: str 

34 

35 def __new__( 

36 cls, 

37 code: str, 

38 resolution_message: str | None = None, 

39 label: str | None = None, 

40 ) -> "ModelObjType": 

41 obj = str.__new__(cls, code) 

42 obj._value_ = code 

43 # Only set attributes if they are provided (during member definition) 

44 if resolution_message is not None: 

45 obj._resolution_message = resolution_message 

46 if label is not None: 

47 obj._label = label 

48 return obj 

49 

50 # ---- Members -------------------------------------------------------- 

51 # fmt: off 

52 USER = ("user", " user flag ", "User Interaction") 

53 GROUP = ("group", " group flag ", "Group Interaction") 

54 DARE = ("dare", " dare flag ", "Dare") 

55 GROUP_DARE = ("group_dare", " group dare flag ", "Group Dare") 

56 CHAT = ("chat", " chat flag ", "Chat Message") 

57 # fmt: on 

58 # ---- Properties ----------------------------------------------------- 

59 @property 

60 def resolution_message(self) -> str: 

61 return self._resolution_message 

62 

63 @property 

64 def label(self) -> str: 

65 return self._label 

66 

67 # ---- Convenience predicates ----------------------------------------- 

68 @property 

69 def search_obj_type(self) -> SearchObjType | None: 

70 match self: 

71 case ModelObjType.USER: 

72 return SearchObjType.USER 

73 case ModelObjType.GROUP: 

74 return SearchObjType.GROUP 

75 case ModelObjType.DARE: 

76 return SearchObjType.DARE 

77 case ModelObjType.GROUP_DARE: 

78 return SearchObjType.GROUP_DARE 

79 case ModelObjType.CHAT: 

80 return None