enum Action {
  update,
  add,
  delete,
}

extension ActionExtension on Action {
  String get value {
    switch (this) {
      case Action.update:
        return 'update';
      case Action.add:
        return 'add';
      case Action.delete:
        return 'delete';
    }
  }

  static Action fromValue(String value) {
    switch (value) {
      case 'update':
        return Action.update;
      case 'add':
        return Action.add;
      case 'delete':
        return Action.delete;
      default:
        throw ArgumentError('Invalid action: $value');
    }
  }
}
