1 #pragma once
2 #include "nlohmann/json_fwd.hpp"
3 #include "util/uuid.hpp"
4 
5 namespace horizon {
6 using json = nlohmann::json;
7 
8 class RuleMatch {
9 public:
10     RuleMatch();
11     RuleMatch(const json &j, const class RuleImportMap &import_map);
12     RuleMatch(const json &j);
13     json serialize() const;
14     std::string get_brief(const class Block *block = nullptr) const;
15     void cleanup(const class Block *block);
16     bool can_export() const;
17 
18     enum class Mode { ALL, NET, NET_CLASS, NET_NAME_REGEX, NET_CLASS_REGEX };
19     Mode mode = Mode::ALL;
20 
21     UUID net;
22     UUID net_class;
23     std::string net_name_regex;
24     std::string net_class_regex;
25 
26     bool match(const class Net *net) const;
27 };
28 } // namespace horizon
29