maleo-enums 0.0.27__py3-none-any.whl → 0.0.30__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.
@@ -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 OrganizationType(StrEnum):
@@ -17,7 +18,7 @@ class OrganizationType(StrEnum):
17
18
  INSURANCE_PROVIDER = "insurance_provider"
18
19
  INTERNAL = "internal"
19
20
  LABORATORY = "laboratory"
20
- MEDICAL_GROUP = "medical_group"
21
+ MEDICAL_GROUP = "organization_group"
21
22
  NETWORK = "network"
22
23
  PARTNER = "partner"
23
24
  PHARMACY = "pharmacy"
@@ -32,22 +33,58 @@ class OrganizationType(StrEnum):
32
33
  VENDOR = "vendor"
33
34
 
34
35
  @classmethod
35
- def choices(cls) -> ListOfStrings:
36
+ def choices(cls) -> ListOfStrs:
36
37
  return [e.value for e in cls]
37
38
 
38
39
 
39
40
  OrganizationTypeT = TypeVar("OrganizationTypeT", bound=OrganizationType)
40
- OptionalOrganizationType = Optional[OrganizationType]
41
- OptionalOrganizationTypeT = TypeVar(
42
- "OptionalOrganizationTypeT", bound=OptionalOrganizationType
41
+ OptOrganizationType = OrganizationType | None
42
+ OptOrganizationTypeT = TypeVar("OptOrganizationTypeT", bound=OptOrganizationType)
43
+
44
+
45
+ class SimpleOrganizationTypeMixin(BaseModel, Generic[OptOrganizationTypeT]):
46
+ type: Annotated[OptOrganizationTypeT, Field(..., description="Organization Type")]
47
+
48
+
49
+ class FullOrganizationTypeMixin(BaseModel, Generic[OptOrganizationTypeT]):
50
+ organization_type: Annotated[
51
+ OptOrganizationTypeT, Field(..., description="Organization Type")
52
+ ]
53
+
54
+
55
+ ListOfOrganizationTypes = list[OrganizationType]
56
+ ListOfOrganizationTypesT = TypeVar(
57
+ "ListOfOrganizationTypesT", bound=ListOfOrganizationTypes
58
+ )
59
+ OptListOfOrganizationTypes = ListOfOrganizationTypes | None
60
+ OptListOfOrganizationTypesT = TypeVar(
61
+ "OptListOfOrganizationTypesT", bound=OptListOfOrganizationTypes
62
+ )
63
+
64
+
65
+ class SimpleOrganizationTypesMixin(BaseModel, Generic[OptListOfOrganizationTypesT]):
66
+ types: Annotated[
67
+ OptListOfOrganizationTypesT, Field(..., description="Organization Types")
68
+ ]
69
+
70
+
71
+ class FullOrganizationTypesMixin(BaseModel, Generic[OptListOfOrganizationTypesT]):
72
+ organization_types: Annotated[
73
+ OptListOfOrganizationTypesT, Field(..., description="Organization Types")
74
+ ]
75
+
76
+
77
+ SeqOfOrganizationTypes = Sequence[OrganizationType]
78
+ SeqOfOrganizationTypesT = TypeVar(
79
+ "SeqOfOrganizationTypesT", bound=SeqOfOrganizationTypes
80
+ )
81
+ OptSeqOfOrganizationTypes = SeqOfOrganizationTypes | None
82
+ OptSeqOfOrganizationTypesT = TypeVar(
83
+ "OptSeqOfOrganizationTypesT", bound=OptSeqOfOrganizationTypes
43
84
  )
44
- ListOfOrganizationTypes = List[OrganizationType]
45
- OptionalListOfOrganizationTypes = Optional[ListOfOrganizationTypes]
46
- SequenceOfOrganizationTypes = Sequence[OrganizationType]
47
- OptionalSequenceOfOrganizationTypes = Optional[SequenceOfOrganizationTypes]
48
85
 
49
86
 
50
- class Relation(StrEnum):
87
+ class OrganizationRelation(StrEnum):
51
88
  AFFILIATE = "affiliate"
52
89
  APPLICATION = "application"
53
90
  BRANCH = "branch"
@@ -61,33 +98,119 @@ class Relation(StrEnum):
61
98
  VENDOR = "vendor"
62
99
 
63
100
  @classmethod
64
- def choices(cls) -> ListOfStrings:
101
+ def choices(cls) -> ListOfStrs:
65
102
  return [e.value for e in cls]
66
103
 
67
104
 
68
- RelationT = TypeVar("RelationT", bound=Relation)
69
- OptionalRelation = Optional[Relation]
70
- OptionalRelationT = TypeVar("OptionalRelationT", bound=OptionalRelation)
71
- ListOfRelations = List[Relation]
72
- OptionalListOfRelations = Optional[ListOfRelations]
73
- SequenceOfRelations = Sequence[Relation]
74
- OptionalSequenceOfRelations = Optional[SequenceOfRelations]
105
+ OrganizationRelationT = TypeVar("OrganizationRelationT", bound=OrganizationRelation)
106
+ OptOrganizationRelation = OrganizationRelation | None
107
+ OptOrganizationRelationT = TypeVar(
108
+ "OptOrganizationRelationT", bound=OptOrganizationRelation
109
+ )
110
+
111
+
112
+ class SimpleOrganizationRelationMixin(BaseModel, Generic[OptOrganizationRelationT]):
113
+ relation: Annotated[
114
+ OptOrganizationRelationT, Field(..., description="Organization Relation")
115
+ ]
116
+
117
+
118
+ class FullOrganizationRelationMixin(BaseModel, Generic[OptOrganizationRelationT]):
119
+ organization_relation: Annotated[
120
+ OptOrganizationRelationT, Field(..., description="Organization Relation")
121
+ ]
122
+
123
+
124
+ ListOfOrganizationRelations = list[OrganizationRelation]
125
+ ListOfOrganizationRelationsT = TypeVar(
126
+ "ListOfOrganizationRelationsT", bound=ListOfOrganizationRelations
127
+ )
128
+ OptListOfOrganizationRelations = ListOfOrganizationRelations | None
129
+ OptListOfOrganizationRelationsT = TypeVar(
130
+ "OptListOfOrganizationRelationsT", bound=OptListOfOrganizationRelations
131
+ )
132
+
133
+
134
+ class SimpleOrganizationRelationsMixin(
135
+ BaseModel, Generic[OptListOfOrganizationRelationsT]
136
+ ):
137
+ relations: Annotated[
138
+ OptListOfOrganizationRelationsT,
139
+ Field(..., description="Organization Relations"),
140
+ ]
141
+
142
+
143
+ class FullOrganizationRelationsMixin(
144
+ BaseModel, Generic[OptListOfOrganizationRelationsT]
145
+ ):
146
+ organization_relations: Annotated[
147
+ OptListOfOrganizationRelationsT,
148
+ Field(..., description="Organization Relations"),
149
+ ]
150
+
151
+
152
+ SeqOfOrganizationRelations = Sequence[OrganizationRelation]
153
+ SeqOfOrganizationRelationsT = TypeVar(
154
+ "SeqOfOrganizationRelationsT", bound=SeqOfOrganizationRelations
155
+ )
156
+ OptSeqOfOrganizationRelations = SeqOfOrganizationRelations | None
157
+ OptSeqOfOrganizationRelationsT = TypeVar(
158
+ "OptSeqOfOrganizationRelationsT", bound=OptSeqOfOrganizationRelations
159
+ )
75
160
 
76
161
 
77
- class Role(StrEnum):
162
+ class OrganizationRole(StrEnum):
78
163
  OWNER = "owner"
79
164
  ADMINISTRATOR = "administrator"
80
165
  USER = "user"
81
166
 
82
167
  @classmethod
83
- def choices(cls) -> ListOfStrings:
168
+ def choices(cls) -> ListOfStrs:
84
169
  return [e.value for e in cls]
85
170
 
86
171
 
87
- RoleT = TypeVar("RoleT", bound=Role)
88
- OptionalRole = Optional[Role]
89
- OptionalRoleT = TypeVar("OptionalRoleT", bound=OptionalRole)
90
- ListOfRoles = List[Role]
91
- OptionalListOfRoles = Optional[ListOfRoles]
92
- SequenceOfRoles = Sequence[Role]
93
- OptionalSequenceOfRoles = Optional[SequenceOfRoles]
172
+ OrganizationRoleT = TypeVar("OrganizationRoleT", bound=OrganizationRole)
173
+ OptOrganizationRole = OrganizationRole | None
174
+ OptOrganizationRoleT = TypeVar("OptOrganizationRoleT", bound=OptOrganizationRole)
175
+
176
+
177
+ class SimpleOrganizationRoleMixin(BaseModel, Generic[OptOrganizationRoleT]):
178
+ role: Annotated[OptOrganizationRoleT, Field(..., description="Organization Role")]
179
+
180
+
181
+ class FullOrganizationRoleMixin(BaseModel, Generic[OptOrganizationRoleT]):
182
+ organization_role: Annotated[
183
+ OptOrganizationRoleT, Field(..., description="Organization Role")
184
+ ]
185
+
186
+
187
+ ListOfOrganizationRoles = list[OrganizationRole]
188
+ ListOfOrganizationRolesT = TypeVar(
189
+ "ListOfOrganizationRolesT", bound=ListOfOrganizationRoles
190
+ )
191
+ OptListOfOrganizationRoles = ListOfOrganizationRoles | None
192
+ OptListOfOrganizationRolesT = TypeVar(
193
+ "OptListOfOrganizationRolesT", bound=OptListOfOrganizationRoles
194
+ )
195
+
196
+
197
+ class SimpleOrganizationRolesMixin(BaseModel, Generic[OptListOfOrganizationRolesT]):
198
+ roles: Annotated[
199
+ OptListOfOrganizationRolesT, Field(..., description="Organization Roles")
200
+ ]
201
+
202
+
203
+ class FullOrganizationRolesMixin(BaseModel, Generic[OptListOfOrganizationRolesT]):
204
+ organization_roles: Annotated[
205
+ OptListOfOrganizationRolesT, Field(..., description="Organization Roles")
206
+ ]
207
+
208
+
209
+ SeqOfOrganizationRoles = Sequence[OrganizationRole]
210
+ SeqOfOrganizationRolesT = TypeVar(
211
+ "SeqOfOrganizationRolesT", bound=SeqOfOrganizationRoles
212
+ )
213
+ OptSeqOfOrganizationRoles = SeqOfOrganizationRoles | None
214
+ OptSeqOfOrganizationRolesT = TypeVar(
215
+ "OptSeqOfOrganizationRolesT", bound=OptSeqOfOrganizationRoles
216
+ )
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,38 +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]
19
- OptionalListOfServiceTypes = Optional[ListOfServiceTypes]
20
- SequenceOfServiceTypes = Sequence[ServiceType]
21
- OptionalSequenceOfServiceTypes = Optional[SequenceOfServiceTypes]
17
+ OptServiceType = ServiceType | None
18
+ OptServiceTypeT = TypeVar("OptServiceTypeT", bound=OptServiceType)
22
19
 
23
20
 
24
- class Category(StrEnum):
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]
30
+ ListOfServiceTypesT = TypeVar("ListOfServiceTypesT", bound=ListOfServiceTypes)
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")]
37
+
38
+
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):
25
52
  CORE = "core"
26
53
  AI = "ai"
27
54
 
28
55
  @classmethod
29
- def choices(cls) -> ListOfStrings:
56
+ def choices(cls) -> ListOfStrs:
30
57
  return [e.value for e in cls]
31
58
 
32
59
 
33
- CategoryT = TypeVar("CategoryT", bound=Category)
34
- OptionalCategory = Optional[Category]
35
- OptionalCategoryT = TypeVar("OptionalCategoryT", bound=OptionalCategory)
36
- ListOfCategories = List[Category]
37
- OptionalListOfCategories = Optional[ListOfCategories]
38
- SequenceOfCategories = Sequence[Category]
39
- OptionalSequenceOfCategories = Optional[SequenceOfCategories]
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
78
+ )
79
+ OptListOfServiceCategories = ListOfServiceCategories | None
80
+ OptListOfServiceCategoriesT = TypeVar(
81
+ "OptListOfServiceCategoriesT", bound=OptListOfServiceCategories
82
+ )
40
83
 
41
84
 
42
- 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):
43
108
  STUDIO = "studio"
44
109
  NEXUS = "nexus"
45
110
  TELEMETRY = "telemetry"
@@ -58,20 +123,52 @@ class ShortKey(StrEnum):
58
123
  MCU = "mcu"
59
124
 
60
125
  @classmethod
61
- def choices(cls) -> ListOfStrings:
126
+ def choices(cls) -> ListOfStrs:
62
127
  return [e.value for e in cls]
63
128
 
64
129
 
65
- ShortKeyT = TypeVar("ShortKeyT", bound=ShortKey)
66
- OptionalShortKey = Optional[ShortKey]
67
- OptionalShortKeyT = TypeVar("OptionalShortKeyT", bound=OptionalShortKey)
68
- ListOfShortKeys = List[ShortKey]
69
- OptionalListOfShortKeys = Optional[ListOfShortKeys]
70
- SequenceOfShortKeys = Sequence[ShortKey]
71
- OptionalSequenceOfShortKeys = Optional[SequenceOfShortKeys]
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
150
+ )
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
168
+ )
72
169
 
73
170
 
74
- class Key(StrEnum):
171
+ class ServiceKey(StrEnum):
75
172
  STUDIO = "maleo-studio"
76
173
  NEXUS = "maleo-nexus"
77
174
  TELEMETRY = "maleo-telemetry"
@@ -90,20 +187,46 @@ class Key(StrEnum):
90
187
  MCU = "maleo-mcu"
91
188
 
92
189
  @classmethod
93
- def choices(cls) -> ListOfStrings:
190
+ def choices(cls) -> ListOfStrs:
94
191
  return [e.value for e in cls]
95
192
 
96
193
 
97
- KeyT = TypeVar("KeyT", bound=Key)
98
- OptionalKey = Optional[Key]
99
- OptionalKeyT = TypeVar("OptionalKeyT", bound=OptionalKey)
100
- ListOfKeys = List[Key]
101
- OptionalListOfKeys = Optional[ListOfKeys]
102
- SequenceOfKeys = Sequence[Key]
103
- OptionalSequenceOfKeys = Optional[SequenceOfKeys]
194
+ ServiceKeyT = TypeVar("ServiceKeyT", bound=ServiceKey)
195
+ OptServiceKey = ServiceKey | None
196
+ OptServiceKeyT = TypeVar("OptServiceKeyT", bound=OptServiceKey)
104
197
 
105
198
 
106
- class ShortName(StrEnum):
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
+
216
+
217
+ class FullServiceKeysMixin(BaseModel, Generic[OptListOfServiceKeysT]):
218
+ service_keys: Annotated[
219
+ OptListOfServiceKeysT, Field(..., description="Service Keys")
220
+ ]
221
+
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):
107
230
  STUDIO = "Studio"
108
231
  NEXUS = "Nexus"
109
232
  TELEMETRY = "Telemetry"
@@ -122,20 +245,58 @@ class ShortName(StrEnum):
122
245
  MCU = "MCU"
123
246
 
124
247
  @classmethod
125
- def choices(cls) -> ListOfStrings:
248
+ def choices(cls) -> ListOfStrs:
126
249
  return [e.value for e in cls]
127
250
 
128
251
 
129
- ShortNameT = TypeVar("ShortNameT", bound=ShortName)
130
- OptionalShortName = Optional[ShortName]
131
- OptionalShortNameT = TypeVar("OptionalShortNameT", bound=OptionalShortName)
132
- ListOfShortNames = List[ShortName]
133
- OptionalListOfShortNames = Optional[ListOfShortNames]
134
- SequenceOfShortNames = Sequence[ShortName]
135
- OptionalSequenceOfShortNames = Optional[SequenceOfShortNames]
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
270
+ )
271
+ OptListOfShortServiceNames = ListOfShortServiceNames | None
272
+ OptListOfShortServiceNamesT = TypeVar(
273
+ "OptListOfShortServiceNamesT", bound=OptListOfShortServiceNames
274
+ )
136
275
 
137
276
 
138
- 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):
139
300
  STUDIO = "MaleoStudio"
140
301
  NEXUS = "MaleoNexus"
141
302
  TELEMETRY = "MaleoTelemetry"
@@ -154,14 +315,40 @@ class Name(StrEnum):
154
315
  MCU = "MaleoMCU"
155
316
 
156
317
  @classmethod
157
- def choices(cls) -> ListOfStrings:
318
+ def choices(cls) -> ListOfStrs:
158
319
  return [e.value for e in cls]
159
320
 
160
321
 
161
- NameT = TypeVar("NameT", bound=Name)
162
- OptionalName = Optional[Name]
163
- OptionalNameT = TypeVar("OptionalNameT", bound=OptionalName)
164
- ListOfNames = List[Name]
165
- OptionalListOfNames = Optional[ListOfNames]
166
- SequenceOfNames = Sequence[Name]
167
- OptionalSequenceOfNames = Optional[SequenceOfNames]
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,26 +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]
20
- OptionalListOfDataStatuses = Optional[ListOfDataStatuses]
21
- SequenceOfDataStatuses = Sequence[DataStatus]
22
- OptionalSequenceOfDataStatuses = Optional[SequenceOfDataStatuses]
18
+ OptDataStatus = DataStatus | None
19
+ OptDataStatusT = TypeVar("OptDataStatusT", bound=OptDataStatus)
23
20
 
24
21
 
25
- FULL_DATA_STATUSES: SequenceOfDataStatuses = (
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]
31
+ ListOfDataStatusesT = TypeVar("ListOfDataStatusesT", bound=ListOfDataStatuses)
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 = [
26
51
  DataStatus.ACTIVE,
27
52
  DataStatus.INACTIVE,
28
53
  DataStatus.DELETED,
29
- )
54
+ ]
30
55
 
31
- BASIC_DATA_STATUSES: SequenceOfDataStatuses = (
56
+ BASIC_DATA_STATUSES: ListOfDataStatuses = [
32
57
  DataStatus.ACTIVE,
33
58
  DataStatus.INACTIVE,
34
- )
59
+ ]