import 'package:equatable/equatable.dart'; import '../../data/models/action_output.dart'; /// Domain entity representing an action mapping configuration /// Maps input actions (events) to output actions (responses) class ActionMapping extends Equatable { final String id; final String name; final String? description; final String inputAction; final Map inputParameters; final List outputActions; final String? geviscopeInstanceScope; final bool enabled; final int executionCount; final DateTime? lastExecuted; final DateTime createdAt; final DateTime updatedAt; final String createdBy; const ActionMapping({ required this.id, required this.name, this.description, required this.inputAction, this.inputParameters = const {}, required this.outputActions, this.geviscopeInstanceScope, this.enabled = true, this.executionCount = 0, this.lastExecuted, required this.createdAt, required this.updatedAt, required this.createdBy, }); /// Create a copy of this action mapping with some fields replaced ActionMapping copyWith({ String? id, String? name, String? description, String? inputAction, Map? inputParameters, List? outputActions, String? geviscopeInstanceScope, bool? enabled, int? executionCount, DateTime? lastExecuted, DateTime? createdAt, DateTime? updatedAt, String? createdBy, }) { return ActionMapping( id: id ?? this.id, name: name ?? this.name, description: description ?? this.description, inputAction: inputAction ?? this.inputAction, inputParameters: inputParameters ?? this.inputParameters, outputActions: outputActions ?? this.outputActions, geviscopeInstanceScope: geviscopeInstanceScope ?? this.geviscopeInstanceScope, enabled: enabled ?? this.enabled, executionCount: executionCount ?? this.executionCount, lastExecuted: lastExecuted ?? this.lastExecuted, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, createdBy: createdBy ?? this.createdBy, ); } @override List get props => [ id, name, description, inputAction, inputParameters, outputActions, geviscopeInstanceScope, enabled, executionCount, lastExecuted, createdAt, updatedAt, createdBy, ]; @override String toString() { return 'ActionMapping(id: $id, name: $name, inputAction: $inputAction, ' 'outputActions: ${outputActions.length} actions, enabled: $enabled)'; } }