aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Decision.hpp
blob: 452512dc250f34dd36e332a362416444d0c2cc98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include "openvic-simulation/types/IdentifierRegistry.hpp"

namespace OpenVic {
   struct DecisionManager;

   struct Decision : HasIdentifier {
      friend struct DecisionManager;

   private:
      const bool PROPERTY_CUSTOM_PREFIX(alert, has);
      const bool PROPERTY_CUSTOM_PREFIX(news, is);
      const std::string PROPERTY(news_title);
      const std::string PROPERTY(news_desc_long);
      const std::string PROPERTY(news_desc_medium);
      const std::string PROPERTY(news_desc_short);
      const std::string PROPERTY(picture);

      Decision(
         std::string_view new_identifier, bool new_alert, bool new_news,
         std::string_view new_news_title, std::string_view new_news_desc_long,
         std::string_view new_news_desc_medium, std::string_view new_news_desc_short,
         std::string_view new_picture
      );

   public:
      Decision(Decision&&) = default;
   };

   struct DecisionManager {
   private:
      IdentifierRegistry<Decision> IDENTIFIER_REGISTRY(decision);

   public:
      bool add_decision(
         std::string_view identifier, bool alert, bool news, std::string_view news_title,
         std::string_view news_desc_long, std::string_view news_desc_medium,
         std::string_view news_desc_short, std::string_view picture
      );

      bool load_decision_file(ast::NodeCPtr root);
   };
}