""" Service Management model classes for the service management system. Updated to match the Entity Relation Diagram structure. """ from pydantic import BaseModel, Field from typing import List, Dict, Any, Optional from datetime import datetime import uuid from modules.shared.attributeUtils import Label, BaseModelWithUI # CORE MODELS class FileItem(BaseModelWithUI): """Data model for a file item""" id: int = Field(description="Primary key") mandateId: str = Field(description="ID of the mandate this file belongs to") filename: str = Field(description="Name of the file") mimeType: str = Field(description="MIME type of the file") workflowId: Optional[str] = Field(None, description="Foreign key to workflow") fileHash: str = Field(description="Hash of the file") fileSize: int = Field(description="Size of the file in bytes") label: Label = Field( default=Label(default="File Item", translations={"en": "File Item", "fr": "Élément de fichier"}), description="Label for the class" ) fieldLabels: Dict[str, Label] = { "id": Label(default="ID", translations={}), "mandateId": Label(default="Mandate ID", translations={"en": "Mandate ID", "fr": "ID du mandat"}), "filename": Label(default="Filename", translations={"en": "Filename", "fr": "Nom de fichier"}), "mimeType": Label(default="MIME Type", translations={"en": "MIME Type", "fr": "Type MIME"}), "workflowId": Label(default="Workflow ID", translations={"en": "Workflow ID", "fr": "ID du flux de travail"}), "fileHash": Label(default="File Hash", translations={"en": "File Hash", "fr": "Hash du fichier"}), "fileSize": Label(default="File Size", translations={"en": "File Size", "fr": "Taille du fichier"}) } class FileData(BaseModelWithUI): """Data model for file data""" id: int = Field(description="Primary key") data: str = Field(description="File data content") base64Encoded: bool = Field(description="Whether the data is base64 encoded") label: Label = Field( default=Label(default="File Data", translations={"en": "File Data", "fr": "Données de fichier"}), description="Label for the class" ) fieldLabels: Dict[str, Label] = { "id": Label(default="ID", translations={}), "data": Label(default="Data", translations={"en": "Data", "fr": "Données"}), "base64Encoded": Label(default="Base64 Encoded", translations={"en": "Base64 Encoded", "fr": "Encodé en Base64"}) } class Prompt(BaseModelWithUI): """Data model for a prompt""" id: int = Field(description="Primary key") mandateId: str = Field(description="ID of the mandate this prompt belongs to") content: str = Field(description="Content of the prompt") name: str = Field(description="Name of the prompt") label: Label = Field( default=Label(default="Prompt", translations={"en": "Prompt", "fr": "Invite"}), description="Label for the class" ) fieldLabels: Dict[str, Label] = { "id": Label(default="ID", translations={}), "mandateId": Label(default="Mandate ID", translations={"en": "Mandate ID", "fr": "ID du mandat"}), "content": Label(default="Content", translations={"en": "Content", "fr": "Contenu"}), "name": Label(default="Name", translations={"en": "Name", "fr": "Nom"}) }