# ProjectUtility/core/models.py import dataclasses from typing import List, Dict, Any, Optional # Import Optional for non-mandatory fields @dataclasses.dataclass( frozen=True ) # frozen=True makes instances immutable after creation class ToolParameter: """Represents a parameter required by a tool.""" name: str # Internal name/key for the parameter (e.g., "input_file") label: str # User-friendly label for the GUI (e.g., "Input PNG File:") type: str # Data type hint (e.g., "string", "file", "folder", "integer", "boolean") required: bool # Is this parameter mandatory? default: Any = None # Default value (can be None) description: Optional[str] = None # Optional tooltip or help text options: Optional[Dict[str, Any]] = ( None # Optional dictionary for specific types (e.g., file extensions {'filter': '*.png'}) ) @dataclasses.dataclass(frozen=True) class ToolInfo: """Holds all configuration information for a single tool.""" id: str # Unique identifier for the tool (e.g., "icon_generator") display_name: str # Name shown in the GUI list (e.g., "Icon Generator") description: str # Brief description shown in the GUI command: List[ str ] # The command and its base arguments to execute (e.g., ["python", "generate_icon.py"]) # Use a list for better handling with subprocess working_dir: ( str # The directory where the command should be executed (absolute path) ) parameters: List[ToolParameter] = dataclasses.field( default_factory=list ) # List of required parameters version: Optional[str] = None # Optional tool version string has_gui: bool = False # Add other fields if needed, e.g., 'icon_path' for a tool-specific icon