/// Represents a standing order in the IT0 system.
class StandingOrder {
  final String id;
  final String name;
  final String triggerType; // cron, event, threshold
  final String? schedule;
  final String? agentInstructions;
  final String? decisionBoundary;
  final bool isActive;
  final DateTime? lastExecutedAt;
  final DateTime? createdAt;

  const StandingOrder({
    required this.id,
    required this.name,
    required this.triggerType,
    this.schedule,
    this.agentInstructions,
    this.decisionBoundary,
    required this.isActive,
    this.lastExecutedAt,
    this.createdAt,
  });

  StandingOrder copyWith({
    String? id,
    String? name,
    String? triggerType,
    String? schedule,
    String? agentInstructions,
    String? decisionBoundary,
    bool? isActive,
    DateTime? lastExecutedAt,
    DateTime? createdAt,
  }) {
    return StandingOrder(
      id: id ?? this.id,
      name: name ?? this.name,
      triggerType: triggerType ?? this.triggerType,
      schedule: schedule ?? this.schedule,
      agentInstructions: agentInstructions ?? this.agentInstructions,
      decisionBoundary: decisionBoundary ?? this.decisionBoundary,
      isActive: isActive ?? this.isActive,
      lastExecutedAt: lastExecutedAt ?? this.lastExecutedAt,
      createdAt: createdAt ?? this.createdAt,
    );
  }
}
