import 'package:flutter/material.dart';
import 'package:equatable/equatable.dart';

class RuleInfo {
  final String id;
  final String name;
  final String description;
  final bool enabled;
  final String triggerCondition;
  final String action;
  final IconData icon;

  const RuleInfo({
    required this.id,
    required this.name,
    required this.description,
    required this.enabled,
    required this.triggerCondition,
    required this.action,
    required this.icon,
  });

  RuleInfo copyWith({
    String? id,
    String? name,
    String? description,
    bool? enabled,
    String? triggerCondition,
    String? action,
    IconData? icon,
  }) {
    return RuleInfo(
      id: id ?? this.id,
      name: name ?? this.name,
      description: description ?? this.description,
      enabled: enabled ?? this.enabled,
      triggerCondition: triggerCondition ?? this.triggerCondition,
      action: action ?? this.action,
      icon: icon ?? this.icon,
    );
  }
}

class RuleManagementState extends Equatable {
  final List<RuleInfo> rules;

  const RuleManagementState({
    this.rules = const [],
  });

  RuleManagementState copyWith({
    List<RuleInfo>? rules,
  }) {
    return RuleManagementState(
      rules: rules ?? this.rules,
    );
  }

  @override
  List<Object?> get props => [rules];
}
