maleo-enums 0.0.28__py3-none-any.whl → 0.0.32__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
maleo/enums/service.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from enum import StrEnum
2
- from typing import List, Optional, Sequence, TypeVar
3
- from maleo.types.string import ListOfStrings
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, Sequence, TypeVar
4
+ from maleo.types.string import ListOfStrs
4
5
 
5
6
 
6
7
  class ServiceType(StrEnum):
@@ -8,56 +9,102 @@ class ServiceType(StrEnum):
8
9
  FRONTEND = "frontend"
9
10
 
10
11
  @classmethod
11
- def choices(cls) -> ListOfStrings:
12
+ def choices(cls) -> ListOfStrs:
12
13
  return [e.value for e in cls]
13
14
 
14
15
 
15
16
  ServiceTypeT = TypeVar("ServiceTypeT", bound=ServiceType)
16
- OptionalServiceType = Optional[ServiceType]
17
- OptionalServiceTypeT = TypeVar("OptionalServiceTypeT", bound=OptionalServiceType)
18
- ListOfServiceTypes = List[ServiceType]
17
+ OptServiceType = ServiceType | None
18
+ OptServiceTypeT = TypeVar("OptServiceTypeT", bound=OptServiceType)
19
+
20
+
21
+ class SimpleServiceTypeMixin(BaseModel, Generic[OptServiceTypeT]):
22
+ type: Annotated[OptServiceTypeT, Field(..., description="Service Type")]
23
+
24
+
25
+ class FullServiceTypeMixin(BaseModel, Generic[OptServiceTypeT]):
26
+ service_type: Annotated[OptServiceTypeT, Field(..., description="Service Type")]
27
+
28
+
29
+ ListOfServiceTypes = list[ServiceType]
19
30
  ListOfServiceTypesT = TypeVar("ListOfServiceTypesT", bound=ListOfServiceTypes)
20
- OptionalListOfServiceTypes = Optional[ListOfServiceTypes]
21
- OptionalListOfServiceTypesT = TypeVar(
22
- "OptionalListOfServiceTypesT", bound=OptionalListOfServiceTypes
23
- )
24
- SequenceOfServiceTypes = Sequence[ServiceType]
25
- SequenceOfServiceTypesT = TypeVar(
26
- "SequenceOfServiceTypesT", bound=SequenceOfServiceTypes
27
- )
28
- OptionalSequenceOfServiceTypes = Optional[SequenceOfServiceTypes]
29
- OptionalSequenceOfServiceTypesT = TypeVar(
30
- "OptionalSequenceOfServiceTypesT", bound=OptionalSequenceOfServiceTypes
31
- )
31
+ OptListOfServiceTypes = ListOfServiceTypes | None
32
+ OptListOfServiceTypesT = TypeVar("OptListOfServiceTypesT", bound=OptListOfServiceTypes)
33
+
34
+
35
+ class SimpleServiceTypesMixin(BaseModel, Generic[OptListOfServiceTypesT]):
36
+ types: Annotated[OptListOfServiceTypesT, Field(..., description="Service Types")]
32
37
 
33
38
 
34
- class Category(StrEnum):
39
+ class FullServiceTypesMixin(BaseModel, Generic[OptListOfServiceTypesT]):
40
+ service_types: Annotated[
41
+ OptListOfServiceTypesT, Field(..., description="Service Types")
42
+ ]
43
+
44
+
45
+ SeqOfServiceTypes = Sequence[ServiceType]
46
+ SeqOfServiceTypesT = TypeVar("SeqOfServiceTypesT", bound=SeqOfServiceTypes)
47
+ OptSeqOfServiceTypes = SeqOfServiceTypes | None
48
+ OptSeqOfServiceTypesT = TypeVar("OptSeqOfServiceTypesT", bound=OptSeqOfServiceTypes)
49
+
50
+
51
+ class ServiceCategory(StrEnum):
35
52
  CORE = "core"
36
53
  AI = "ai"
37
54
 
38
55
  @classmethod
39
- def choices(cls) -> ListOfStrings:
56
+ def choices(cls) -> ListOfStrs:
40
57
  return [e.value for e in cls]
41
58
 
42
59
 
43
- CategoryT = TypeVar("CategoryT", bound=Category)
44
- OptionalCategory = Optional[Category]
45
- OptionalCategoryT = TypeVar("OptionalCategoryT", bound=OptionalCategory)
46
- ListOfCategories = List[Category]
47
- ListOfCategoriesT = TypeVar("ListOfCategoriesT", bound=ListOfCategories)
48
- OptionalListOfCategories = Optional[ListOfCategories]
49
- OptionalListOfCategoriesT = TypeVar(
50
- "OptionalListOfCategoriesT", bound=OptionalListOfCategories
60
+ ServiceCategoryT = TypeVar("ServiceCategoryT", bound=ServiceCategory)
61
+ OptServiceCategory = ServiceCategory | None
62
+ OptServiceCategoryT = TypeVar("OptServiceCategoryT", bound=OptServiceCategory)
63
+
64
+
65
+ class SimpleServiceCategoryMixin(BaseModel, Generic[OptServiceCategoryT]):
66
+ category: Annotated[OptServiceCategoryT, Field(..., description="Service Category")]
67
+
68
+
69
+ class FullServiceCategoryMixin(BaseModel, Generic[OptServiceCategoryT]):
70
+ service_category: Annotated[
71
+ OptServiceCategoryT, Field(..., description="Service Category")
72
+ ]
73
+
74
+
75
+ ListOfServiceCategories = list[ServiceCategory]
76
+ ListOfServiceCategoriesT = TypeVar(
77
+ "ListOfServiceCategoriesT", bound=ListOfServiceCategories
51
78
  )
52
- SequenceOfCategories = Sequence[Category]
53
- SequenceOfCategoriesT = TypeVar("SequenceOfCategoriesT", bound=SequenceOfCategories)
54
- OptionalSequenceOfCategories = Optional[SequenceOfCategories]
55
- OptionalSequenceOfCategoriesT = TypeVar(
56
- "OptionalSequenceOfCategoriesT", bound=OptionalSequenceOfCategories
79
+ OptListOfServiceCategories = ListOfServiceCategories | None
80
+ OptListOfServiceCategoriesT = TypeVar(
81
+ "OptListOfServiceCategoriesT", bound=OptListOfServiceCategories
57
82
  )
58
83
 
59
84
 
60
- class ShortKey(StrEnum):
85
+ class SimpleServiceCategoriesMixin(BaseModel, Generic[OptListOfServiceCategoriesT]):
86
+ categories: Annotated[
87
+ OptListOfServiceCategoriesT, Field(..., description="Service Categories")
88
+ ]
89
+
90
+
91
+ class FullServiceCategoriesMixin(BaseModel, Generic[OptListOfServiceCategoriesT]):
92
+ service_categories: Annotated[
93
+ OptListOfServiceCategoriesT, Field(..., description="Service Categories")
94
+ ]
95
+
96
+
97
+ SeqOfServiceCategories = Sequence[ServiceCategory]
98
+ SeqOfServiceCategoriesT = TypeVar(
99
+ "SeqOfServiceCategoriesT", bound=SeqOfServiceCategories
100
+ )
101
+ OptSeqOfServiceCategories = SeqOfServiceCategories | None
102
+ OptSeqOfServiceCategoriesT = TypeVar(
103
+ "OptSeqOfServiceCategoriesT", bound=OptSeqOfServiceCategories
104
+ )
105
+
106
+
107
+ class ShortServiceKey(StrEnum):
61
108
  STUDIO = "studio"
62
109
  NEXUS = "nexus"
63
110
  TELEMETRY = "telemetry"
@@ -76,28 +123,52 @@ class ShortKey(StrEnum):
76
123
  MCU = "mcu"
77
124
 
78
125
  @classmethod
79
- def choices(cls) -> ListOfStrings:
126
+ def choices(cls) -> ListOfStrs:
80
127
  return [e.value for e in cls]
81
128
 
82
129
 
83
- ShortKeyT = TypeVar("ShortKeyT", bound=ShortKey)
84
- OptionalShortKey = Optional[ShortKey]
85
- OptionalShortKeyT = TypeVar("OptionalShortKeyT", bound=OptionalShortKey)
86
- ListOfShortKeys = List[ShortKey]
87
- ListOfShortKeysT = TypeVar("ListOfShortKeysT", bound=ListOfShortKeys)
88
- OptionalListOfShortKeys = Optional[ListOfShortKeys]
89
- OptionalListOfShortKeysT = TypeVar(
90
- "OptionalListOfShortKeysT", bound=OptionalListOfShortKeys
130
+ ShortServiceKeyT = TypeVar("ShortServiceKeyT", bound=ShortServiceKey)
131
+ OptShortServiceKey = ShortServiceKey | None
132
+ OptShortServiceKeyT = TypeVar("OptShortServiceKeyT", bound=OptShortServiceKey)
133
+
134
+
135
+ class SimpleShortServiceKeyMixin(BaseModel, Generic[OptShortServiceKeyT]):
136
+ key: Annotated[OptShortServiceKeyT, Field(..., description="Service Key")]
137
+
138
+
139
+ class FullShortServiceKeyMixin(BaseModel, Generic[OptShortServiceKeyT]):
140
+ service_key: Annotated[OptShortServiceKeyT, Field(..., description="Service Key")]
141
+
142
+
143
+ ListOfShortServiceKeys = list[ShortServiceKey]
144
+ ListOfShortServiceKeysT = TypeVar(
145
+ "ListOfShortServiceKeysT", bound=ListOfShortServiceKeys
146
+ )
147
+ OptListOfShortServiceKeys = ListOfShortServiceKeys | None
148
+ OptListOfShortServiceKeysT = TypeVar(
149
+ "OptListOfShortServiceKeysT", bound=OptListOfShortServiceKeys
91
150
  )
92
- SequenceOfShortKeys = Sequence[ShortKey]
93
- SequenceOfShortKeysT = TypeVar("SequenceOfShortKeysT", bound=SequenceOfShortKeys)
94
- OptionalSequenceOfShortKeys = Optional[SequenceOfShortKeys]
95
- OptionalSequenceOfShortKeysT = TypeVar(
96
- "OptionalSequenceOfShortKeysT", bound=OptionalSequenceOfShortKeys
151
+
152
+
153
+ class SimpleShortServiceKeysMixin(BaseModel, Generic[OptListOfShortServiceKeysT]):
154
+ keys: Annotated[OptListOfShortServiceKeysT, Field(..., description="Service Keys")]
155
+
156
+
157
+ class FullShortServiceKeysMixin(BaseModel, Generic[OptListOfShortServiceKeysT]):
158
+ service_keys: Annotated[
159
+ OptListOfShortServiceKeysT, Field(..., description="Service Keys")
160
+ ]
161
+
162
+
163
+ SeqOfShortServiceKeys = Sequence[ShortServiceKey]
164
+ SeqOfShortServiceKeysT = TypeVar("SeqOfShortServiceKeysT", bound=SeqOfShortServiceKeys)
165
+ OptSeqOfShortServiceKeys = SeqOfShortServiceKeys | None
166
+ OptSeqOfShortServiceKeysT = TypeVar(
167
+ "OptSeqOfShortServiceKeysT", bound=OptSeqOfShortServiceKeys
97
168
  )
98
169
 
99
170
 
100
- class Key(StrEnum):
171
+ class ServiceKey(StrEnum):
101
172
  STUDIO = "maleo-studio"
102
173
  NEXUS = "maleo-nexus"
103
174
  TELEMETRY = "maleo-telemetry"
@@ -116,26 +187,46 @@ class Key(StrEnum):
116
187
  MCU = "maleo-mcu"
117
188
 
118
189
  @classmethod
119
- def choices(cls) -> ListOfStrings:
190
+ def choices(cls) -> ListOfStrs:
120
191
  return [e.value for e in cls]
121
192
 
122
193
 
123
- KeyT = TypeVar("KeyT", bound=Key)
124
- OptionalKey = Optional[Key]
125
- OptionalKeyT = TypeVar("OptionalKeyT", bound=OptionalKey)
126
- ListOfKeys = List[Key]
127
- ListOfKeysT = TypeVar("ListOfKeysT", bound=ListOfKeys)
128
- OptionalListOfKeys = Optional[ListOfKeys]
129
- OptionalListOfKeysT = TypeVar("OptionalListOfKeysT", bound=OptionalListOfKeys)
130
- SequenceOfKeys = Sequence[Key]
131
- SequenceOfKeysT = TypeVar("SequenceOfKeysT", bound=SequenceOfKeys)
132
- OptionalSequenceOfKeys = Optional[SequenceOfKeys]
133
- OptionalSequenceOfKeysT = TypeVar(
134
- "OptionalSequenceOfKeysT", bound=OptionalSequenceOfKeys
135
- )
194
+ ServiceKeyT = TypeVar("ServiceKeyT", bound=ServiceKey)
195
+ OptServiceKey = ServiceKey | None
196
+ OptServiceKeyT = TypeVar("OptServiceKeyT", bound=OptServiceKey)
197
+
198
+
199
+ class SimpleServiceKeyMixin(BaseModel, Generic[OptServiceKeyT]):
200
+ key: Annotated[OptServiceKeyT, Field(..., description="Service Key")]
201
+
202
+
203
+ class FullServiceKeyMixin(BaseModel, Generic[OptServiceKeyT]):
204
+ service_key: Annotated[OptServiceKeyT, Field(..., description="Service Key")]
205
+
206
+
207
+ ListOfServiceKeys = list[ServiceKey]
208
+ ListOfServiceKeysT = TypeVar("ListOfServiceKeysT", bound=ListOfServiceKeys)
209
+ OptListOfServiceKeys = ListOfServiceKeys | None
210
+ OptListOfServiceKeysT = TypeVar("OptListOfServiceKeysT", bound=OptListOfServiceKeys)
211
+
212
+
213
+ class SimpleServiceKeysMixin(BaseModel, Generic[OptListOfServiceKeysT]):
214
+ keys: Annotated[OptListOfServiceKeysT, Field(..., description="Service Keys")]
215
+
136
216
 
217
+ class FullServiceKeysMixin(BaseModel, Generic[OptListOfServiceKeysT]):
218
+ service_keys: Annotated[
219
+ OptListOfServiceKeysT, Field(..., description="Service Keys")
220
+ ]
137
221
 
138
- class ShortName(StrEnum):
222
+
223
+ SeqOfServiceKeys = Sequence[ServiceKey]
224
+ SeqOfServiceKeysT = TypeVar("SeqOfServiceKeysT", bound=SeqOfServiceKeys)
225
+ OptSeqOfServiceKeys = SeqOfServiceKeys | None
226
+ OptSeqOfServiceKeysT = TypeVar("OptSeqOfServiceKeysT", bound=OptSeqOfServiceKeys)
227
+
228
+
229
+ class ShortServiceName(StrEnum):
139
230
  STUDIO = "Studio"
140
231
  NEXUS = "Nexus"
141
232
  TELEMETRY = "Telemetry"
@@ -154,28 +245,58 @@ class ShortName(StrEnum):
154
245
  MCU = "MCU"
155
246
 
156
247
  @classmethod
157
- def choices(cls) -> ListOfStrings:
248
+ def choices(cls) -> ListOfStrs:
158
249
  return [e.value for e in cls]
159
250
 
160
251
 
161
- ShortNameT = TypeVar("ShortNameT", bound=ShortName)
162
- OptionalShortName = Optional[ShortName]
163
- OptionalShortNameT = TypeVar("OptionalShortNameT", bound=OptionalShortName)
164
- ListOfShortNames = List[ShortName]
165
- ListOfShortNamesT = TypeVar("ListOfShortNamesT", bound=ListOfShortNames)
166
- OptionalListOfShortNames = Optional[ListOfShortNames]
167
- OptionalListOfShortNamesT = TypeVar(
168
- "OptionalListOfShortNamesT", bound=OptionalListOfShortNames
252
+ ShortServiceNameT = TypeVar("ShortServiceNameT", bound=ShortServiceName)
253
+ OptShortServiceName = ShortServiceName | None
254
+ OptShortServiceNameT = TypeVar("OptShortServiceNameT", bound=OptShortServiceName)
255
+
256
+
257
+ class SimpleShortServiceNameMixin(BaseModel, Generic[OptShortServiceNameT]):
258
+ name: Annotated[OptShortServiceNameT, Field(..., description="Service Name")]
259
+
260
+
261
+ class FullShortServiceNameMixin(BaseModel, Generic[OptShortServiceNameT]):
262
+ service_name: Annotated[
263
+ OptShortServiceNameT, Field(..., description="Service Name")
264
+ ]
265
+
266
+
267
+ ListOfShortServiceNames = list[ShortServiceName]
268
+ ListOfShortServiceNamesT = TypeVar(
269
+ "ListOfShortServiceNamesT", bound=ListOfShortServiceNames
169
270
  )
170
- SequenceOfShortNames = Sequence[ShortName]
171
- SequenceOfShortNamesT = TypeVar("SequenceOfShortNamesT", bound=SequenceOfShortNames)
172
- OptionalSequenceOfShortNames = Optional[SequenceOfShortNames]
173
- OptionalSequenceOfShortNamesT = TypeVar(
174
- "OptionalSequenceOfShortNamesT", bound=OptionalSequenceOfShortNames
271
+ OptListOfShortServiceNames = ListOfShortServiceNames | None
272
+ OptListOfShortServiceNamesT = TypeVar(
273
+ "OptListOfShortServiceNamesT", bound=OptListOfShortServiceNames
175
274
  )
176
275
 
177
276
 
178
- class Name(StrEnum):
277
+ class SimpleShortServiceNamesMixin(BaseModel, Generic[OptListOfShortServiceNamesT]):
278
+ names: Annotated[
279
+ OptListOfShortServiceNamesT, Field(..., description="Service Names")
280
+ ]
281
+
282
+
283
+ class FullShortServiceNamesMixin(BaseModel, Generic[OptListOfShortServiceNamesT]):
284
+ service_names: Annotated[
285
+ OptListOfShortServiceNamesT, Field(..., description="Service Names")
286
+ ]
287
+
288
+
289
+ SeqOfShortServiceNames = Sequence[ShortServiceName]
290
+ SeqOfShortServiceNamesT = TypeVar(
291
+ "SeqOfShortServiceNamesT", bound=SeqOfShortServiceNames
292
+ )
293
+ OptSeqOfShortServiceNames = SeqOfShortServiceNames | None
294
+ OptSeqOfShortServiceNamesT = TypeVar(
295
+ "OptSeqOfShortServiceNamesT", bound=OptSeqOfShortServiceNames
296
+ )
297
+
298
+
299
+ class ServiceName(StrEnum):
179
300
  STUDIO = "MaleoStudio"
180
301
  NEXUS = "MaleoNexus"
181
302
  TELEMETRY = "MaleoTelemetry"
@@ -194,20 +315,40 @@ class Name(StrEnum):
194
315
  MCU = "MaleoMCU"
195
316
 
196
317
  @classmethod
197
- def choices(cls) -> ListOfStrings:
318
+ def choices(cls) -> ListOfStrs:
198
319
  return [e.value for e in cls]
199
320
 
200
321
 
201
- NameT = TypeVar("NameT", bound=Name)
202
- OptionalName = Optional[Name]
203
- OptionalNameT = TypeVar("OptionalNameT", bound=OptionalName)
204
- ListOfNames = List[Name]
205
- ListOfNamesT = TypeVar("ListOfNamesT", bound=ListOfNames)
206
- OptionalListOfNames = Optional[ListOfNames]
207
- OptionalListOfNamesT = TypeVar("OptionalListOfNamesT", bound=OptionalListOfNames)
208
- SequenceOfNames = Sequence[Name]
209
- SequenceOfNamesT = TypeVar("SequenceOfNamesT", bound=SequenceOfNames)
210
- OptionalSequenceOfNames = Optional[SequenceOfNames]
211
- OptionalSequenceOfNamesT = TypeVar(
212
- "OptionalSequenceOfNamesT", bound=OptionalSequenceOfNames
213
- )
322
+ ServiceNameT = TypeVar("ServiceNameT", bound=ServiceName)
323
+ OptServiceName = ServiceName | None
324
+ OptServiceNameT = TypeVar("OptServiceNameT", bound=OptServiceName)
325
+
326
+
327
+ class SimpleServiceNameMixin(BaseModel, Generic[OptServiceNameT]):
328
+ name: Annotated[OptServiceNameT, Field(..., description="Service Name")]
329
+
330
+
331
+ class FullServiceNameMixin(BaseModel, Generic[OptServiceNameT]):
332
+ service_name: Annotated[OptServiceNameT, Field(..., description="Service Name")]
333
+
334
+
335
+ ListOfServiceNames = list[ServiceName]
336
+ ListOfServiceNamesT = TypeVar("ListOfServiceNamesT", bound=ListOfServiceNames)
337
+ OptListOfServiceNames = ListOfServiceNames | None
338
+ OptListOfServiceNamesT = TypeVar("OptListOfServiceNamesT", bound=OptListOfServiceNames)
339
+
340
+
341
+ class SimpleServiceNamesMixin(BaseModel, Generic[OptListOfServiceNamesT]):
342
+ names: Annotated[OptListOfServiceNamesT, Field(..., description="Service Names")]
343
+
344
+
345
+ class FullServiceNamesMixin(BaseModel, Generic[OptListOfServiceNamesT]):
346
+ service_names: Annotated[
347
+ OptListOfServiceNamesT, Field(..., description="Service Names")
348
+ ]
349
+
350
+
351
+ SeqOfServiceNames = Sequence[ServiceName]
352
+ SeqOfServiceNamesT = TypeVar("SeqOfServiceNamesT", bound=SeqOfServiceNames)
353
+ OptSeqOfServiceNames = SeqOfServiceNames | None
354
+ OptSeqOfServiceNamesT = TypeVar("OptSeqOfServiceNamesT", bound=OptSeqOfServiceNames)
maleo/enums/status.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from enum import StrEnum
2
- from typing import List, Optional, Sequence, TypeVar
3
- from maleo.types.string import ListOfStrings
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, Sequence, TypeVar
4
+ from maleo.types.string import ListOfStrs
4
5
 
5
6
 
6
7
  class DataStatus(StrEnum):
@@ -9,36 +10,50 @@ class DataStatus(StrEnum):
9
10
  ACTIVE = "active"
10
11
 
11
12
  @classmethod
12
- def choices(cls) -> ListOfStrings:
13
+ def choices(cls) -> ListOfStrs:
13
14
  return [e.value for e in cls]
14
15
 
15
16
 
16
17
  DataStatusT = TypeVar("DataStatusT", bound=DataStatus)
17
- OptionalDataStatus = Optional[DataStatus]
18
- OptionalDataStatusT = TypeVar("OptionalDataStatusT", bound=OptionalDataStatus)
19
- ListOfDataStatuses = List[DataStatus]
18
+ OptDataStatus = DataStatus | None
19
+ OptDataStatusT = TypeVar("OptDataStatusT", bound=OptDataStatus)
20
+
21
+
22
+ class SimpleDataStatusMixin(BaseModel, Generic[OptDataStatusT]):
23
+ status: Annotated[OptDataStatusT, Field(..., description="Status")]
24
+
25
+
26
+ class FullDataStatusMixin(BaseModel, Generic[OptDataStatusT]):
27
+ data_status: Annotated[OptDataStatusT, Field(..., description="Status")]
28
+
29
+
30
+ ListOfDataStatuses = list[DataStatus]
20
31
  ListOfDataStatusesT = TypeVar("ListOfDataStatusesT", bound=ListOfDataStatuses)
21
- OptionalListOfDataStatuses = Optional[ListOfDataStatuses]
22
- OptionalListOfDataStatusesT = TypeVar(
23
- "OptionalListOfDataStatusesT", bound=OptionalListOfDataStatuses
24
- )
25
- SequenceOfDataStatuses = Sequence[DataStatus]
26
- SequenceOfDataStatusesT = TypeVar(
27
- "SequenceOfDataStatusesT", bound=SequenceOfDataStatuses
28
- )
29
- OptionalSequenceOfDataStatuses = Optional[SequenceOfDataStatuses]
30
- OptionalSequenceOfDataStatusesT = TypeVar(
31
- "OptionalSequenceOfDataStatusesT", bound=OptionalSequenceOfDataStatuses
32
- )
33
-
34
-
35
- FULL_DATA_STATUSES: SequenceOfDataStatuses = (
32
+ OptListOfDataStatuses = ListOfDataStatuses | None
33
+ OptListOfDataStatusesT = TypeVar("OptListOfDataStatusesT", bound=OptListOfDataStatuses)
34
+
35
+
36
+ class SimpleDataStatusesMixin(BaseModel, Generic[OptListOfDataStatusesT]):
37
+ statuses: Annotated[OptListOfDataStatusesT, Field(..., description="Statuses")]
38
+
39
+
40
+ class FullDataStatusesMixin(BaseModel, Generic[OptListOfDataStatusesT]):
41
+ data_statuses: Annotated[OptListOfDataStatusesT, Field(..., description="Statuses")]
42
+
43
+
44
+ SeqOfDataStatuses = Sequence[DataStatus]
45
+ SeqOfDataStatusesT = TypeVar("SeqOfDataStatusesT", bound=SeqOfDataStatuses)
46
+ OptSeqOfDataStatuses = SeqOfDataStatuses | None
47
+ OptSeqOfDataStatusesT = TypeVar("OptSeqOfDataStatusesT", bound=OptSeqOfDataStatuses)
48
+
49
+
50
+ FULL_DATA_STATUSES: ListOfDataStatuses = [
36
51
  DataStatus.ACTIVE,
37
52
  DataStatus.INACTIVE,
38
53
  DataStatus.DELETED,
39
- )
54
+ ]
40
55
 
41
- BASIC_DATA_STATUSES: SequenceOfDataStatuses = (
56
+ BASIC_DATA_STATUSES: ListOfDataStatuses = [
42
57
  DataStatus.ACTIVE,
43
58
  DataStatus.INACTIVE,
44
- )
59
+ ]
maleo/enums/system.py CHANGED
@@ -1,9 +1,10 @@
1
1
  from enum import StrEnum
2
- from typing import List, Optional, Sequence, TypeVar
3
- from maleo.types.string import ListOfStrings
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, Sequence, TypeVar
4
+ from maleo.types.string import ListOfStrs
4
5
 
5
6
 
6
- class Role(StrEnum):
7
+ class SystemRole(StrEnum):
7
8
  ADMINISTRATOR = "administrator"
8
9
  ANALYST = "analyst"
9
10
  ENGINEER = "engineer"
@@ -17,20 +18,40 @@ class Role(StrEnum):
17
18
  USER = "user"
18
19
 
19
20
  @classmethod
20
- def choices(cls) -> ListOfStrings:
21
+ def choices(cls) -> ListOfStrs:
21
22
  return [e.value for e in cls]
22
23
 
23
24
 
24
- RoleT = TypeVar("RoleT", bound=Role)
25
- OptionalRole = Optional[Role]
26
- OptionalRoleT = TypeVar("OptionalRoleT", bound=OptionalRole)
27
- ListOfRoles = List[Role]
28
- ListOfRolesT = TypeVar("ListOfRolesT", bound=ListOfRoles)
29
- OptionalListOfRoles = Optional[ListOfRoles]
30
- OptionalListOfRolesT = TypeVar("OptionalListOfRolesT", bound=OptionalListOfRoles)
31
- SequenceOfRoles = Sequence[Role]
32
- SequenceOfRolesT = TypeVar("SequenceOfRolesT", bound=SequenceOfRoles)
33
- OptionalSequenceOfRoles = Optional[SequenceOfRoles]
34
- OptionalSequenceOfRolesT = TypeVar(
35
- "OptionalSequenceOfRolesT", bound=OptionalSequenceOfRoles
36
- )
25
+ SystemRoleT = TypeVar("SystemRoleT", bound=SystemRole)
26
+ OptSystemRole = SystemRole | None
27
+ OptSystemRoleT = TypeVar("OptSystemRoleT", bound=OptSystemRole)
28
+
29
+
30
+ class SimpleSystemRoleMixin(BaseModel, Generic[OptSystemRoleT]):
31
+ role: Annotated[OptSystemRoleT, Field(..., description="System Role")]
32
+
33
+
34
+ class FullSystemRoleMixin(BaseModel, Generic[OptSystemRoleT]):
35
+ system_role: Annotated[OptSystemRoleT, Field(..., description="System Role")]
36
+
37
+
38
+ ListOfSystemRoles = list[SystemRole]
39
+ ListOfSystemRolesT = TypeVar("ListOfSystemRolesT", bound=ListOfSystemRoles)
40
+ OptListOfSystemRoles = ListOfSystemRoles | None
41
+ OptListOfSystemRolesT = TypeVar("OptListOfSystemRolesT", bound=OptListOfSystemRoles)
42
+
43
+
44
+ class SimpleSystemRolesMixin(BaseModel, Generic[OptListOfSystemRolesT]):
45
+ roles: Annotated[OptListOfSystemRolesT, Field(..., description="System Roles")]
46
+
47
+
48
+ class FullSystemRolesMixin(BaseModel, Generic[OptListOfSystemRolesT]):
49
+ system_roles: Annotated[
50
+ OptListOfSystemRolesT, Field(..., description="System Roles")
51
+ ]
52
+
53
+
54
+ SeqOfSystemRoles = Sequence[SystemRole]
55
+ SeqOfSystemRolesT = TypeVar("SeqOfSystemRolesT", bound=SeqOfSystemRoles)
56
+ OptSeqOfSystemRoles = SeqOfSystemRoles | None
57
+ OptSeqOfSystemRolesT = TypeVar("OptSeqOfSystemRolesT", bound=OptSeqOfSystemRoles)
maleo/enums/user.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from enum import StrEnum
2
- from typing import List, Optional, Sequence, TypeVar
3
- from maleo.types.string import ListOfStrings
2
+ from pydantic import BaseModel, Field
3
+ from typing import Annotated, Generic, Sequence, TypeVar
4
+ from maleo.types.string import ListOfStrs
4
5
 
5
6
 
6
7
  class UserType(StrEnum):
@@ -9,22 +10,38 @@ class UserType(StrEnum):
9
10
  SERVICE = "service"
10
11
 
11
12
  @classmethod
12
- def choices(cls) -> ListOfStrings:
13
+ def choices(cls) -> ListOfStrs:
13
14
  return [e.value for e in cls]
14
15
 
15
16
 
16
17
  UserTypeT = TypeVar("UserTypeT", bound=UserType)
17
- OptionalUserType = Optional[UserType]
18
- OptionalUserTypeT = TypeVar("OptionalUserTypeT", bound=OptionalUserType)
19
- ListOfUserTypes = List[UserType]
18
+ OptUserType = UserType | None
19
+ OptUserTypeT = TypeVar("OptUserTypeT", bound=OptUserType)
20
+
21
+
22
+ class SimpleUserTypeMixin(BaseModel, Generic[OptUserTypeT]):
23
+ type: Annotated[OptUserTypeT, Field(..., description="User Type")]
24
+
25
+
26
+ class FullUserTypeMixin(BaseModel, Generic[OptUserTypeT]):
27
+ user_type: Annotated[OptUserTypeT, Field(..., description="User Type")]
28
+
29
+
30
+ ListOfUserTypes = list[UserType]
20
31
  ListOfUserTypesT = TypeVar("ListOfUserTypesT", bound=ListOfUserTypes)
21
- OptionalListOfUserTypes = Optional[ListOfUserTypes]
22
- OptionalListOfUserTypesT = TypeVar(
23
- "OptionalListOfUserTypesT", bound=OptionalListOfUserTypes
24
- )
25
- SequenceOfUserTypes = Sequence[UserType]
26
- SequenceOfUserTypesT = TypeVar("SequenceOfUserTypesT", bound=SequenceOfUserTypes)
27
- OptionalSequenceOfUserTypes = Optional[SequenceOfUserTypes]
28
- OptionalSequenceOfUserTypesT = TypeVar(
29
- "OptionalSequenceOfUserTypesT", bound=OptionalSequenceOfUserTypes
30
- )
32
+ OptListOfUserTypes = ListOfUserTypes | None
33
+ OptListOfUserTypesT = TypeVar("OptListOfUserTypesT", bound=OptListOfUserTypes)
34
+
35
+
36
+ class SimpleUserTypesMixin(BaseModel, Generic[OptListOfUserTypesT]):
37
+ types: Annotated[OptListOfUserTypesT, Field(..., description="User Types")]
38
+
39
+
40
+ class FullUserTypesMixin(BaseModel, Generic[OptListOfUserTypesT]):
41
+ user_types: Annotated[OptListOfUserTypesT, Field(..., description="User Types")]
42
+
43
+
44
+ SeqOfUserTypes = Sequence[UserType]
45
+ SeqOfUserTypesT = TypeVar("SeqOfUserTypesT", bound=SeqOfUserTypes)
46
+ OptSeqOfUserTypes = SeqOfUserTypes | None
47
+ OptSeqOfUserTypesT = TypeVar("OptSeqOfUserTypesT", bound=OptSeqOfUserTypes)
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo-enums
3
- Version: 0.0.28
3
+ Version: 0.0.32
4
4
  Summary: Enums package for MaleoSuite
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: Proprietary
7
7
  Requires-Python: >=3.12
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: annotated-types>=0.7.0
10
11
  Requires-Dist: black>=25.1.0
11
12
  Requires-Dist: cfgv>=3.4.0
12
13
  Requires-Dist: click>=8.2.1
@@ -14,14 +15,18 @@ Requires-Dist: colorama>=0.4.6
14
15
  Requires-Dist: distlib>=0.4.0
15
16
  Requires-Dist: filelock>=3.19.1
16
17
  Requires-Dist: identify>=2.6.13
17
- Requires-Dist: maleo-types>=0.0.8
18
+ Requires-Dist: maleo-types>=0.0.12
18
19
  Requires-Dist: mypy_extensions>=1.1.0
19
20
  Requires-Dist: nodeenv>=1.9.1
20
21
  Requires-Dist: packaging>=25.0
21
22
  Requires-Dist: pathspec>=0.12.1
22
23
  Requires-Dist: platformdirs>=4.4.0
23
24
  Requires-Dist: pre_commit>=4.3.0
25
+ Requires-Dist: pydantic>=2.12.2
26
+ Requires-Dist: pydantic_core>=2.41.4
24
27
  Requires-Dist: PyYAML>=6.0.2
28
+ Requires-Dist: typing-inspection>=0.4.2
29
+ Requires-Dist: typing_extensions>=4.15.0
25
30
  Requires-Dist: virtualenv>=20.34.0
26
31
  Dynamic: license-file
27
32