enum Action {
  create,
  read,
  update,
  delete,
}

extension ActionExtension on Action {
  String toShortString() => toString().split('.').last;

  static Action fromString(String value) => Action.values.firstWhere(
    (e) => e.toShortString() == value,
    orElse: () => throw ArgumentError('Invalid action: $value'),
  );
}
