52 lines
2.2 KiB
Python
52 lines
2.2 KiB
Python
"""Protocol/Log models"""
|
|
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ProtocolEntry(BaseModel):
|
|
"""A single entry in a protocol log"""
|
|
|
|
timestamp: Optional[str] = Field(None, description="Timestamp of the entry")
|
|
level: Optional[str] = Field(None, description="Log level (ERROR, WARNING, INFO, etc.)")
|
|
message: Optional[str] = Field(None, description="Message content")
|
|
|
|
|
|
class ProtocolInfo(BaseModel):
|
|
"""Protocol/Log information"""
|
|
|
|
id: Optional[int] = Field(None, description="Protocol ID")
|
|
protocolId: Optional[str] = Field(None, description="Protocol ID as string")
|
|
jobId: Optional[int] = Field(None, description="Associated job ID")
|
|
runtimeId: Optional[str] = Field(None, description="Runtime ID of the job execution")
|
|
jobIdentifier: Optional[str] = Field(None, description="Job identifier")
|
|
status: Optional[str] = Field(None, description="Status of the job")
|
|
startTime: Optional[str] = Field(None, description="Start time of execution")
|
|
endTime: Optional[str] = Field(None, description="End time of execution")
|
|
errors: List[str] = Field(default_factory=list, description="List of errors")
|
|
messages: List[str] = Field(default_factory=list, description="List of messages")
|
|
entries: Optional[List[ProtocolEntry]] = Field(None, description="Protocol entries")
|
|
|
|
|
|
class ProtocolListResponse(BaseModel):
|
|
"""Response containing list of protocols"""
|
|
|
|
protocols: Optional[List[ProtocolInfo]] = Field(None, description="List of protocols")
|
|
errors: List[str] = Field(default_factory=list, description="List of errors")
|
|
warnings: List[str] = Field(default_factory=list, description="List of warnings")
|
|
|
|
|
|
class ProtocolCategoryInfo(BaseModel):
|
|
"""Protocol category information"""
|
|
|
|
id: str = Field(..., description="Category ID")
|
|
name: str = Field(..., description="Category name")
|
|
description: Optional[str] = Field(None, description="Category description")
|
|
|
|
|
|
class ProtocolCategoryListResponse(BaseModel):
|
|
"""Response containing list of protocol categories"""
|
|
|
|
categories: List[ProtocolCategoryInfo] = Field(..., description="List of protocol categories")
|
|
errors: List[str] = Field(default_factory=list, description="List of errors")
|