aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/Government.hpp
blob: 025e238e46cdda022693d06d6b5262a40d1067d3 (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
45
#pragma once

#include "openvic-simulation/politics/Ideology.hpp"

namespace OpenVic {
   struct GovernmentTypeManager;

   struct GovernmentType : HasIdentifier {
      friend struct GovernmentTypeManager;

   private:
      const std::vector<Ideology const*> PROPERTY(ideologies);
      const bool PROPERTY_CUSTOM_PREFIX(elections, holds);
      const bool PROPERTY_CUSTOM_PREFIX(appoint_ruling_party, can);
      const Timespan PROPERTY(term_duration);
      const std::string PROPERTY_CUSTOM_NAME(flag_type_identifier, get_flag_type);

      GovernmentType(
         std::string_view new_identifier, std::vector<Ideology const*>&& new_ideologies, bool new_elections,
         bool new_appoint_ruling_party, Timespan new_term_duration, std::string_view new_flag_type_identifier
      );

   public:
      GovernmentType(GovernmentType&&) = default;

      bool is_ideology_compatible(Ideology const* ideology) const;
   };

   struct GovernmentTypeManager {
   private:
      IdentifierRegistry<GovernmentType> government_types;
      std::vector<std::string> PROPERTY(flag_types);

   public:
      GovernmentTypeManager();

      bool add_government_type(
         std::string_view identifier, std::vector<Ideology const*>&& ideologies, bool elections, bool appoint_ruling_party,
         Timespan term_duration, std::string_view flag_type
      );
      IDENTIFIER_REGISTRY_ACCESSORS(government_type)

      bool load_government_types_file(IdeologyManager const& ideology_manager, ast::NodeCPtr root);
   };
} // namespace OpenVic