Coverage for functions \ flipdare \ generated \ shared \ model \ pledge_status.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 

24 

25 

26class PledgeStatus(StrEnum): 

27 """Pledge Status""" 

28 

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

30 # They are populated per-member inside __new__. 

31 _label: str 

32 

33 def __new__( 

34 cls, 

35 code: str, 

36 label: str | None = None, 

37 ) -> "PledgeStatus": 

38 obj = str.__new__(cls, code) 

39 obj._value_ = code 

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

41 if label is not None: 

42 obj._label = label 

43 return obj 

44 

45 # ---- Members -------------------------------------------------------- 

46 # fmt: off 

47 UNDECIDED = ("undecided", "The group has not decided on the dare yet.") 

48 VOTE_APPROVED = ("vote_approved", "The group has spoken, dare approved!") 

49 VOTE_REJECTED = ("vote_rejected", "The group has spoken, dare rejected.") 

50 VOTE_AUTO_APPROVED = ("vote_auto_approved", "The dare has been automatically approved.") 

51 VOTE_AUTO_REJECTED = ("vote_auto_rejected", "The dare has been automatically rejected.") 

52 PROCESSING = ("processing", "Your pledge is being processed.") 

53 PROCESSED = ("processed", "Your pledge has been processed successfully.") 

54 CANCELLED = ("cancelled", "Your pledge has been cancelled.") 

55 ERROR = ("error", "There was an error processing your pledge.") 

56 REFUND_REQUESTED = ("refund_requested", "Your refund has been requested.") 

57 REFUND_COMPLETE = ("refund_complete", "Your refund has been completed.") 

58 REFUND_ERROR = ("refund_error", "There was an error processing your refund.") 

59 # fmt: on 

60 # ---- Properties ----------------------------------------------------- 

61 @property 

62 def label(self) -> str: 

63 return self._label 

64 

65 # ---- Convenience predicates ----------------------------------------- 

66 @property 

67 def is_processed(self) -> bool: 

68 return self in { 

69 PledgeStatus.PROCESSED, 

70 PledgeStatus.CANCELLED, 

71 PledgeStatus.REFUND_COMPLETE, 

72 } 

73 

74 @property 

75 def is_error(self) -> bool: 

76 return self in {PledgeStatus.ERROR, PledgeStatus.REFUND_ERROR}