import 'package:freezed_annotation/freezed_annotation.dart'; part 'stack.freezed.dart'; /// Container orchestration stack (Docker Compose stack). @freezed class Stack with _$Stack { const factory Stack({ /// Unique stack identifier. required String id, /// Stack name. required String name, /// Stack type (compose, swarm, kubernetes). @Default(StackType.compose) StackType type, /// Current stack status. @Default(StackStatus.unknown) StackStatus status, /// Number of containers in the stack. @Default(0) int containerCount, /// Number of running containers. @Default(0) int runningCount, /// Path to the compose file (if applicable). String? composeFile, /// Compose YAML content. String? yaml, /// Environment variables for the stack. @Default({}) Map envVars, /// Environment name (e.g., production, staging). String? environment, /// When the stack was created. DateTime? createdAt, /// When the stack was last updated. DateTime? updatedAt, }) = _Stack; const Stack._(); /// Whether all containers in the stack are running. bool get isHealthy => runningCount == containerCount && containerCount > 0; /// Whether the stack has any running containers. bool get hasRunningContainers => runningCount > 0; /// Whether the stack is partially running. bool get isPartial => runningCount > 0 && runningCount < containerCount; } /// Stack orchestration type. enum StackType { compose, swarm, kubernetes, } /// Stack status. enum StackStatus { active, inactive, error, unknown, }