-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshared.py
More file actions
77 lines (61 loc) · 1.91 KB
/
Copy pathshared.py
File metadata and controls
77 lines (61 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
Shared data models and types for the GM Batch Processing POC.
"""
from dataclasses import dataclass
from typing import Optional, List
from enum import Enum
class CommandType(str, Enum):
"""Types of commands that can be sent to vehicles or back-office systems."""
VEHICLE_COMMAND = "vehicle_command" # Commands that connect to vehicle (slower, ~300-600/min)
BACKOFFICE_UPDATE = "backoffice_update" # Database updates (faster, ~1000s/min)
PROFILE_FIX = "profile_fix"
class ProcessingStatus(str, Enum):
"""Status of VIN processing."""
PENDING = "pending"
PROCESSING = "processing"
COMPLETED = "completed"
FAILED = "failed"
NO_CONSENT = "no_consent"
@dataclass
class VINData:
"""Data structure for a single VIN to be processed."""
vin: str
command: str
command_type: str # CommandType value (e.g., "vehicle_command", "backoffice_update")
batch_id: str
additional_params: Optional[dict] = None
@dataclass
class ConsentResult:
"""Result from consent check activity."""
vin: str
has_consent: bool
reason: Optional[str] = None
@dataclass
class PublishResult:
"""Result from publishing to EventHub."""
vin: str
message_id: str
topic: str
success: bool
@dataclass
class DomainResponse:
"""Response received from domain via EventHub."""
vin: str
message_id: str
status: str # ProcessingStatus value (e.g., "completed", "failed")
details: Optional[dict] = None
@dataclass
class VINProcessingResult:
"""Final result of processing a single VIN."""
vin: str
status: str # ProcessingStatus value (e.g., "completed", "failed", "no_consent")
message: Optional[str] = None
details: Optional[dict] = None
@dataclass
class BatchProcessingResult:
"""Final result of processing an entire batch."""
batch_id: str
total_vins_processed: int
successful: int
failed: int
duration_seconds: float