layrz-sdk 3.1.50__py3-none-any.whl → 4.0.1__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.

Potentially problematic release.


This version of layrz-sdk might be problematic. Click here for more details.

Files changed (80) hide show
  1. layrz_sdk/entities/__init__.py +4 -0
  2. layrz_sdk/entities/action.py +5 -21
  3. layrz_sdk/entities/action_geofence_ownership.py +3 -8
  4. layrz_sdk/entities/action_kind.py +3 -8
  5. layrz_sdk/entities/action_subkind.py +3 -8
  6. layrz_sdk/entities/asset.py +14 -9
  7. layrz_sdk/entities/asset_constants.py +1 -1
  8. layrz_sdk/entities/asset_operation_mode.py +3 -8
  9. layrz_sdk/entities/ats_entry.py +14 -0
  10. layrz_sdk/entities/ats_exit_history.py +19 -35
  11. layrz_sdk/entities/ats_possible_entry.py +27 -0
  12. layrz_sdk/entities/ats_possible_exit.py +15 -18
  13. layrz_sdk/entities/ats_reception.py +16 -3
  14. layrz_sdk/entities/broadcast/service.py +1 -1
  15. layrz_sdk/entities/broadcast/status.py +3 -8
  16. layrz_sdk/entities/case.py +2 -8
  17. layrz_sdk/entities/case_ignored_status.py +3 -8
  18. layrz_sdk/entities/case_status.py +3 -8
  19. layrz_sdk/entities/charts/bar_chart.py +1 -7
  20. layrz_sdk/entities/charts/chart_alignment.py +3 -8
  21. layrz_sdk/entities/charts/chart_color.py +3 -8
  22. layrz_sdk/entities/charts/chart_data_serie_type.py +6 -11
  23. layrz_sdk/entities/charts/chart_data_type.py +3 -8
  24. layrz_sdk/entities/charts/chart_render_technology.py +3 -8
  25. layrz_sdk/entities/charts/column_chart.py +3 -8
  26. layrz_sdk/entities/charts/html_chart.py +1 -7
  27. layrz_sdk/entities/charts/line_chart.py +1 -7
  28. layrz_sdk/entities/charts/map_center_type.py +3 -8
  29. layrz_sdk/entities/charts/map_chart.py +1 -7
  30. layrz_sdk/entities/charts/number_chart.py +1 -7
  31. layrz_sdk/entities/charts/pie_chart.py +1 -7
  32. layrz_sdk/entities/charts/radar_chart.py +1 -7
  33. layrz_sdk/entities/charts/radial_bar_chart.py +1 -7
  34. layrz_sdk/entities/charts/scatter_chart.py +1 -7
  35. layrz_sdk/entities/charts/table_chart.py +1 -7
  36. layrz_sdk/entities/charts/timeline_chart.py +1 -7
  37. layrz_sdk/entities/checkpoint.py +1 -2
  38. layrz_sdk/entities/command_series_ticket.py +1 -1
  39. layrz_sdk/entities/comment.py +1 -1
  40. layrz_sdk/entities/destination_phone.py +1 -6
  41. layrz_sdk/entities/device.py +1 -1
  42. layrz_sdk/entities/event.py +1 -1
  43. layrz_sdk/entities/function.py +31 -14
  44. layrz_sdk/entities/geofence.py +1 -1
  45. layrz_sdk/entities/geofence_category.py +3 -8
  46. layrz_sdk/entities/message.py +24 -6
  47. layrz_sdk/entities/modbus/schema.py +2 -2
  48. layrz_sdk/entities/modbus/status.py +2 -2
  49. layrz_sdk/entities/notification_type.py +3 -8
  50. layrz_sdk/entities/operation.py +25 -9
  51. layrz_sdk/entities/operation_case_payload.py +1 -7
  52. layrz_sdk/entities/operation_payload.py +4 -11
  53. layrz_sdk/entities/operation_type.py +3 -8
  54. layrz_sdk/entities/outbound_service.py +1 -1
  55. layrz_sdk/entities/platform.py +3 -8
  56. layrz_sdk/entities/position.py +8 -14
  57. layrz_sdk/entities/presence_type.py +3 -8
  58. layrz_sdk/entities/preset.py +1 -2
  59. layrz_sdk/entities/report.py +1 -7
  60. layrz_sdk/entities/report_col.py +1 -7
  61. layrz_sdk/entities/report_data_type.py +3 -8
  62. layrz_sdk/entities/report_format.py +3 -8
  63. layrz_sdk/entities/request_type.py +3 -8
  64. layrz_sdk/entities/sensor.py +1 -1
  65. layrz_sdk/entities/sound_effect.py +3 -8
  66. layrz_sdk/entities/telemetry/assetmessage.py +4 -11
  67. layrz_sdk/entities/telemetry/devicemessage.py +8 -26
  68. layrz_sdk/entities/text_alignment.py +3 -8
  69. layrz_sdk/entities/trigger.py +1 -1
  70. layrz_sdk/entities/trigger_kind.py +6 -11
  71. layrz_sdk/entities/user.py +1 -1
  72. layrz_sdk/entities/waypoint.py +8 -3
  73. layrz_sdk/entities/weekday.py +3 -8
  74. {layrz_sdk-3.1.50.dist-info → layrz_sdk-4.0.1.dist-info}/METADATA +2 -5
  75. layrz_sdk-4.0.1.dist-info/RECORD +116 -0
  76. layrz_sdk/backwards.py +0 -6
  77. layrz_sdk-3.1.50.dist-info/RECORD +0 -115
  78. {layrz_sdk-3.1.50.dist-info → layrz_sdk-4.0.1.dist-info}/WHEEL +0 -0
  79. {layrz_sdk-3.1.50.dist-info → layrz_sdk-4.0.1.dist-info}/licenses/LICENSE +0 -0
  80. {layrz_sdk-3.1.50.dist-info → layrz_sdk-4.0.1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,8 @@
1
1
  """Column chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
4
+
5
+ from pydantic import BaseModel, Field
5
6
 
6
7
  from layrz_sdk.helpers import convert_to_rgba
7
8
 
@@ -11,12 +12,6 @@ from .chart_data_serie import ChartDataSerie
11
12
  from .chart_data_serie_type import ChartDataSerieType
12
13
  from .chart_render_technology import ChartRenderTechnology
13
14
 
14
- if sys.version_info >= (3, 11):
15
- from typing import Self
16
- else:
17
- from typing_extensions import Self
18
- from pydantic import BaseModel, Field
19
-
20
15
 
21
16
  class ColumnChart(BaseModel):
22
17
  """Column chart configuration"""
@@ -1,15 +1,9 @@
1
1
  """HTML chart"""
2
2
 
3
- import sys
4
- from typing import Any, Dict
3
+ from typing import Any, Dict, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
8
- if sys.version_info >= (3, 11):
9
- from typing import Self
10
- else:
11
- from typing_extensions import Self
12
-
13
7
 
14
8
  class HTMLChart(BaseModel):
15
9
  """HTML chart configuration"""
@@ -1,8 +1,7 @@
1
1
  """Line chart"""
2
2
 
3
3
  import logging
4
- import sys
5
- from typing import Any
4
+ from typing import Any, Self
6
5
 
7
6
  from pydantic import BaseModel, Field
8
7
 
@@ -13,11 +12,6 @@ from .chart_data_serie_type import ChartDataSerieType
13
12
  from .chart_data_type import ChartDataType
14
13
  from .chart_render_technology import ChartRenderTechnology
15
14
 
16
- if sys.version_info >= (3, 11):
17
- from typing import Self
18
- else:
19
- from typing_extensions import Self
20
-
21
15
  log = logging.getLogger(__name__)
22
16
 
23
17
 
@@ -1,13 +1,8 @@
1
- import sys
2
- from enum import Enum
1
+ from enum import StrEnum
2
+ from typing import Self
3
3
 
4
- if sys.version_info >= (3, 11):
5
- from typing import Self
6
- else:
7
- from typing_extensions import Self
8
4
 
9
-
10
- class MapCenterType(str, Enum):
5
+ class MapCenterType(StrEnum):
11
6
  """Map Chart center type"""
12
7
 
13
8
  FIXED = 'FIXED'
@@ -1,7 +1,6 @@
1
1
  """Map chart"""
2
2
 
3
- import sys
4
- from typing import Any, Optional, Tuple
3
+ from typing import Any, Optional, Self, Tuple
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -9,11 +8,6 @@ from .chart_render_technology import ChartRenderTechnology
9
8
  from .map_center_type import MapCenterType
10
9
  from .map_point import MapPoint
11
10
 
12
- if sys.version_info >= (3, 11):
13
- from typing import Self
14
- else:
15
- from typing_extensions import Self
16
-
17
11
 
18
12
  class MapChart(BaseModel):
19
13
  """Map chart configuration"""
@@ -1,17 +1,11 @@
1
1
  """Number chart"""
2
2
 
3
- import sys
4
- from typing import Any, Dict
3
+ from typing import Any, Dict, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
8
7
  from .chart_render_technology import ChartRenderTechnology
9
8
 
10
- if sys.version_info >= (3, 11):
11
- from typing import Self
12
- else:
13
- from typing_extensions import Self
14
-
15
9
 
16
10
  class NumberChart(BaseModel):
17
11
  """Number chart configuration"""
@@ -1,7 +1,6 @@
1
1
  """Pie chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -9,11 +8,6 @@ from .chart_alignment import ChartAlignment
9
8
  from .chart_data_serie import ChartDataSerie
10
9
  from .chart_render_technology import ChartRenderTechnology
11
10
 
12
- if sys.version_info >= (3, 11):
13
- from typing import Self
14
- else:
15
- from typing_extensions import Self
16
-
17
11
 
18
12
  class PieChart(BaseModel):
19
13
  """Pie chart configuration"""
@@ -1,7 +1,6 @@
1
1
  """Radar chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -9,11 +8,6 @@ from .chart_alignment import ChartAlignment
9
8
  from .chart_data_serie import ChartDataSerie
10
9
  from .chart_data_serie_type import ChartDataSerieType
11
10
 
12
- if sys.version_info >= (3, 11):
13
- from typing import Self
14
- else:
15
- from typing_extensions import Self
16
-
17
11
 
18
12
  class RadarChart(BaseModel):
19
13
  """Radar chart configuration"""
@@ -1,7 +1,6 @@
1
1
  """Radial Bar chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -9,11 +8,6 @@ from .chart_alignment import ChartAlignment
9
8
  from .chart_data_serie import ChartDataSerie
10
9
  from .chart_render_technology import ChartRenderTechnology
11
10
 
12
- if sys.version_info >= (3, 11):
13
- from typing import Self
14
- else:
15
- from typing_extensions import Self
16
-
17
11
 
18
12
  class RadialBarChart(BaseModel):
19
13
  """Radial Bar chart configuration"""
@@ -1,7 +1,6 @@
1
1
  """Scatter chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -11,11 +10,6 @@ from .chart_data_serie_type import ChartDataSerieType
11
10
  from .chart_render_technology import ChartRenderTechnology
12
11
  from .scatter_serie import ScatterSerie
13
12
 
14
- if sys.version_info >= (3, 11):
15
- from typing import Self
16
- else:
17
- from typing_extensions import Self
18
-
19
13
 
20
14
  class ScatterChart(BaseModel):
21
15
  """Scatter chart configuration"""
@@ -1,7 +1,6 @@
1
1
  """Number chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -9,11 +8,6 @@ from .chart_render_technology import ChartRenderTechnology
9
8
  from .table_header import TableHeader
10
9
  from .table_row import TableRow
11
10
 
12
- if sys.version_info >= (3, 11):
13
- from typing import Self
14
- else:
15
- from typing_extensions import Self
16
-
17
11
 
18
12
  class TableChart(BaseModel):
19
13
  """Table chart configuration"""
@@ -1,18 +1,12 @@
1
1
  """Timeline chart entities"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
8
7
  from .chart_alignment import ChartAlignment
9
8
  from .timeline_serie import TimelineSerie
10
9
 
11
- if sys.version_info >= (3, 11):
12
- from typing import Self
13
- else:
14
- from typing_extensions import Self
15
-
16
10
 
17
11
  class TimelineChart(BaseModel):
18
12
  """Timeline chart configuration"""
@@ -1,11 +1,10 @@
1
1
  """Checkpoints entitites"""
2
2
 
3
3
  from datetime import datetime
4
+ from enum import StrEnum
4
5
 
5
6
  from pydantic import BaseModel, Field
6
7
 
7
- from layrz_sdk.backwards import StrEnum
8
-
9
8
  from .waypoint import Waypoint, WaypointRef
10
9
 
11
10
 
@@ -1,11 +1,11 @@
1
1
  """Command Series Ticket entity"""
2
2
 
3
3
  from datetime import datetime
4
+ from enum import StrEnum
4
5
  from typing import Any
5
6
 
6
7
  from pydantic import BaseModel, Field
7
8
 
8
- from layrz_sdk.backwards import StrEnum
9
9
  from layrz_sdk.constants import UTC
10
10
  from layrz_sdk.entities.action import Action
11
11
  from layrz_sdk.entities.asset import Asset
@@ -10,7 +10,7 @@ from .user import User
10
10
  class Comment(BaseModel):
11
11
  """Comment entity"""
12
12
 
13
- pk: int = Field(description='Comment ID')
13
+ pk: int = Field(description='Comment ID', alias='id')
14
14
  content: str = Field(description='Comment content')
15
15
  user: User = Field(description='Operator/User what commented the case')
16
16
  submitted_at: datetime = Field(description='Date of comment submission')
@@ -1,9 +1,4 @@
1
- import sys
2
-
3
- if sys.version_info >= (3, 11):
4
- from typing import Self
5
- else:
6
- from typing_extensions import Self
1
+ from typing import Self
7
2
 
8
3
  from pydantic import BaseModel, Field
9
4
 
@@ -8,7 +8,7 @@ from .modbus import ModbusConfig
8
8
  class Device(BaseModel):
9
9
  """Device entity"""
10
10
 
11
- pk: int = Field(description='Defines the primary key of the device')
11
+ pk: int = Field(description='Defines the primary key of the device', alias='id')
12
12
  name: str = Field(description='Defines the name of the device')
13
13
  ident: str = Field(description='Defines the identifier of the device')
14
14
  protocol_id: int | None = Field(
@@ -13,7 +13,7 @@ from .trigger import Trigger
13
13
  class Event(BaseModel):
14
14
  """Event entity definition"""
15
15
 
16
- pk: int = Field(description='Event ID')
16
+ pk: int = Field(description='Event ID', alias='id')
17
17
  trigger: Trigger = Field(description='Event trigger')
18
18
  asset_id: int = Field(description='Asset ID')
19
19
  message: Message = Field(description='Message')
@@ -1,9 +1,9 @@
1
1
  """Geofence entity"""
2
2
 
3
3
  from datetime import timedelta
4
- from typing import Any, Dict, List, Optional
4
+ from typing import Any
5
5
 
6
- from pydantic import BaseModel, Field, constr
6
+ from pydantic import BaseModel, Field
7
7
 
8
8
  from .asset import Asset
9
9
 
@@ -11,19 +11,36 @@ from .asset import Asset
11
11
  class Function(BaseModel):
12
12
  """Function entity"""
13
13
 
14
- pk: int = Field(description='Defines the primary key of the Function')
14
+ pk: int = Field(description='Defines the primary key of the Function', alias='id')
15
15
  name: str = Field(description='Name of the function')
16
16
 
17
- maximum_time: Optional[timedelta] = None # DurationField → timedelta
18
- minutes_delta: Optional[timedelta] = None
19
-
20
- external_identifiers: List[constr(max_length=255)] = Field(default_factory=list) # type: ignore
21
-
22
- credentials: Dict[str, Any] = Field(default_factory=dict)
23
-
24
- # Many-to-manys ➜ list of nested DTOs
25
- assets: List[Asset] = Field(default_factory=list)
17
+ maximum_time: timedelta | None = Field(
18
+ default=None,
19
+ description='Maximum time for the function to run',
20
+ )
21
+ minutes_delta: timedelta | None = Field(
22
+ default=None,
23
+ description='Time delta in minutes for the function to run',
24
+ )
25
+
26
+ external_identifiers: list[str] = Field(
27
+ default_factory=list,
28
+ description='List of external identifiers for the function',
29
+ )
30
+
31
+ credentials: dict[str, Any] = Field(
32
+ default_factory=dict,
33
+ description='Credentials for the function',
34
+ )
35
+
36
+ assets: list[Asset] = Field(
37
+ default_factory=list,
38
+ description='List of assets associated with the function',
39
+ )
26
40
 
27
41
  # Foreign keys – normally expose only the FK id to keep the payload small.
28
- owner_id: Optional[int] = None
29
- algorithm_id: int
42
+ owner_id: int | None = Field(
43
+ default=None,
44
+ description='Owner ID of the function',
45
+ )
46
+ algorithm_id: int = Field(..., description='Algorithm ID of the function')
@@ -6,6 +6,6 @@ from pydantic import BaseModel, Field
6
6
  class Geofence(BaseModel):
7
7
  """Geofence entity"""
8
8
 
9
- pk: int = Field(description='Defines the primary key of the geofence')
9
+ pk: int = Field(description='Defines the primary key of the geofence', alias='id')
10
10
  name: str = Field(description='Defines the name of the geofence')
11
11
  color: str = Field(description='Defines the color of the geofence')
@@ -1,15 +1,10 @@
1
1
  """Geofence category"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class GeofenceCategory(str, Enum):
7
+ class GeofenceCategory(StrEnum):
13
8
  """
14
9
  Geofence category definition
15
10
  """
@@ -15,9 +15,27 @@ PayloadType: TypeAlias = dict[str, Any]
15
15
  class Message(BaseModel):
16
16
  """Message definition"""
17
17
 
18
- pk: int
19
- asset_id: int
20
- position: Position = Field(default_factory=lambda: Position())
21
- payload: PayloadType = Field(default_factory=dict)
22
- sensors: PayloadType = Field(default_factory=dict)
23
- received_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
18
+ model_config = {
19
+ 'json_encoders': {
20
+ datetime: lambda v: v.timestamp(),
21
+ }
22
+ }
23
+
24
+ pk: int = Field(..., description='Message ID', alias='id')
25
+ asset_id: int = Field(..., description='Asset ID')
26
+ position: Position = Field(
27
+ default_factory=lambda: Position(),
28
+ description='Current position of the device',
29
+ )
30
+ payload: PayloadType = Field(
31
+ default_factory=dict,
32
+ description='Payload data of the device message',
33
+ )
34
+ sensors: PayloadType = Field(
35
+ default_factory=dict,
36
+ description='Sensor data of the device message',
37
+ )
38
+ received_at: datetime = Field(
39
+ default_factory=lambda: datetime.now(UTC),
40
+ description='Timestamp when the message was received',
41
+ )
@@ -1,7 +1,7 @@
1
- from enum import Enum
1
+ from enum import StrEnum
2
2
 
3
3
 
4
- class ModbusSchema(str, Enum):
4
+ class ModbusSchema(StrEnum):
5
5
  """Modbus schema enumeration"""
6
6
 
7
7
  SINGLE = 'SINGLE'
@@ -1,7 +1,7 @@
1
- from enum import Enum
1
+ from enum import StrEnum
2
2
 
3
3
 
4
- class ModbusStatus(str, Enum):
4
+ class ModbusStatus(StrEnum):
5
5
  """Modbus schema enumeration"""
6
6
 
7
7
  PENDING = 'PENDING'
@@ -1,15 +1,10 @@
1
1
  """Twilio Notification Type Enum"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class TwilioNotificationType(str, Enum):
7
+ class TwilioNotificationType(StrEnum):
13
8
  """
14
9
  Twilio Notification Type Enum definition
15
10
  """
@@ -1,7 +1,7 @@
1
1
  """Operation entity"""
2
2
 
3
3
  from datetime import time, timedelta
4
- from typing import Any
4
+ from typing import Any, Self
5
5
 
6
6
  from pydantic import BaseModel, Field
7
7
 
@@ -36,18 +36,26 @@ class Operation(BaseModel):
36
36
  description='Defines the cooldown time of the trigger',
37
37
  )
38
38
 
39
- kind: OperationType = Field(
39
+ operation_type: OperationType = Field(
40
40
  ...,
41
41
  description='Defines the kind of the operation',
42
- alias='operation_type',
43
42
  )
44
43
 
45
- http_method: HttpRequestType | None = Field(
44
+ @property
45
+ def kind(self: Self) -> OperationType:
46
+ """Get the kind of the operation"""
47
+ return self.operation_type
48
+
49
+ request_type: HttpRequestType | None = Field(
46
50
  default=None,
47
51
  description='Defines the HTTP method of the operation',
48
- alias='request_type',
49
52
  )
50
53
 
54
+ @property
55
+ def http_method(self: Self) -> HttpRequestType | None:
56
+ """Get the HTTP method of the operation"""
57
+ return self.request_type
58
+
51
59
  url: str | None = Field(
52
60
  default=None,
53
61
  description='Defines the URL of the operation',
@@ -88,18 +96,26 @@ class Operation(BaseModel):
88
96
  description='Defines the color of the operation',
89
97
  )
90
98
 
91
- external_account_id: int | None = Field(
99
+ account_id: int | None = Field(
92
100
  default=None,
93
101
  description='Defines the external account ID of the operation',
94
- alias='account_id',
95
102
  )
96
103
 
97
- twilio_notification_type: TwilioNotificationType = Field(
104
+ @property
105
+ def external_account_id(self: Self) -> int | None:
106
+ """Get the external account ID of the operation"""
107
+ return self.account_id
108
+
109
+ notification_type: TwilioNotificationType = Field(
98
110
  default=TwilioNotificationType.SMS,
99
111
  description='Defines the Twilio notification type of the operation',
100
- alias='notification_type',
101
112
  )
102
113
 
114
+ @property
115
+ def twilio_notification_type(self: Self) -> TwilioNotificationType:
116
+ """Get the Twilio notification type of the operation"""
117
+ return self.notification_type
118
+
103
119
  host_phone: DestinationPhone | None = Field(
104
120
  default=None,
105
121
  description='Defines the host phone number for Twilio notifications',
@@ -18,7 +18,6 @@ class OperationCaseCommentPayload(BaseModel):
18
18
  created_at: datetime = Field(
19
19
  default_factory=lambda: datetime.now(UTC),
20
20
  description='Defines the creation date of the operation case comment',
21
- alias='createdAt',
22
21
  )
23
22
 
24
23
 
@@ -37,12 +36,10 @@ class OperationCasePayload(BaseModel):
37
36
  created_at: datetime = Field(
38
37
  default_factory=lambda: datetime.now(UTC),
39
38
  description='Defines the creation date of the operation case payload',
40
- alias='createdAt',
41
39
  )
42
40
  updated_at: datetime = Field(
43
41
  default_factory=lambda: datetime.now(UTC),
44
42
  description='Defines the last update date of the operation case payload',
45
- alias='updatedAt',
46
43
  )
47
44
 
48
45
  trigger: Trigger = Field(
@@ -55,7 +52,7 @@ class OperationCasePayload(BaseModel):
55
52
  """Serialize trigger to a dictionary"""
56
53
  if isinstance(value, Trigger):
57
54
  return Trigger(
58
- pk=value.pk,
55
+ id=value.pk,
59
56
  name=value.name,
60
57
  code=value.code,
61
58
  )
@@ -67,17 +64,14 @@ class OperationCasePayload(BaseModel):
67
64
  file_id: int | None = Field(
68
65
  default=None,
69
66
  description='Defines the file ID associated with the operation case payload',
70
- alias='fileId',
71
67
  )
72
68
 
73
69
  file_created_at: datetime | None = Field(
74
70
  default=None,
75
71
  description='Defines the creation date of the file associated with the operation case payload',
76
- alias='fileCreatedAt',
77
72
  )
78
73
 
79
74
  comment: OperationCaseCommentPayload | None = Field(
80
75
  default=None,
81
76
  description='Defines the comment associated with the operation case payload',
82
- alias='comment',
83
77
  )
@@ -1,19 +1,12 @@
1
1
  """Operation Payload entity"""
2
2
 
3
- import sys
4
3
  from datetime import datetime, timedelta
5
- from typing import Any
6
-
7
- from layrz_sdk.entities.destination_phone import DestinationPhone
8
-
9
- if sys.version_info >= (3, 11):
10
- from typing import Self
11
- else:
12
- from typing_extensions import Self
4
+ from typing import Any, Self
13
5
 
14
6
  from pydantic import BaseModel, Field, field_validator
15
7
 
16
8
  from layrz_sdk.entities.asset import Asset
9
+ from layrz_sdk.entities.destination_phone import DestinationPhone
17
10
  from layrz_sdk.entities.geofence import Geofence
18
11
  from layrz_sdk.entities.notification_type import TwilioNotificationType
19
12
  from layrz_sdk.entities.operation import Operation
@@ -59,7 +52,7 @@ class OperationPayload(BaseModel):
59
52
  """Serialize asset to a dictionary"""
60
53
  if isinstance(value, Asset):
61
54
  return Asset(
62
- pk=value.pk,
55
+ id=value.pk,
63
56
  name=value.name,
64
57
  operation_mode=value.operation_mode,
65
58
  vin=value.vin,
@@ -80,7 +73,7 @@ class OperationPayload(BaseModel):
80
73
  """Serialize trigger to a dictionary"""
81
74
  if isinstance(value, Trigger):
82
75
  return Trigger(
83
- pk=value.pk,
76
+ id=value.pk,
84
77
  name=value.name,
85
78
  code=value.code,
86
79
  )
@@ -1,15 +1,10 @@
1
1
  """Operation type"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class OperationType(str, Enum):
7
+ class OperationType(StrEnum):
13
8
  """
14
9
  Operation type definition
15
10
  """