aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/PoliticalReform.hpp
blob: 7c778d1d2d8167353c6e3d24587d9e43c68f2c8a (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
46
47
48
49
50
51
52
53
#pragma once

#include <cstddef>
#include "types/IdentifierRegistry.hpp"

namespace OpenVic {
   struct PoliticalReformManager;

   struct PoliticalReformGroup : HasIdentifier {
      friend struct PoliticalReformManager;

   private:
      PoliticalReformGroup(const std::string_view new_identifier, bool ordered);
      const bool ordered; //next_step_only, TODO default to false
   
   public:
      PoliticalReformGroup(PoliticalReformGroup&&) = default;
      bool is_ordered() const;
   };

   struct PoliticalReform : HasIdentifier {
      friend struct PoliticalReformManager;

   private:
      PoliticalReformGroup const& group;
      const size_t ordinal; //assigned by the parser to allow policy sorting

      //TODO - conditions to allow, policy modifiers, policy rule changes

      PoliticalReform(const std::string_view new_identifier, PoliticalReformGroup const& new_group, size_t ordinal);

   public:
      PoliticalReform(PoliticalReform&&) = default;
      size_t get_ordinal() const;
   };

   struct PoliticalReformManager {
   private:
      IdentifierRegistry<PoliticalReformGroup> political_reform_groups;
      IdentifierRegistry<PoliticalReform> political_reforms;

   public:
      PoliticalReformManager();
      
      bool add_political_reform_group(const std::string_view identifier, bool ordered);
      IDENTIFIER_REGISTRY_ACCESSORS(PoliticalReformGroup, political_reform_group)

      bool add_political_reform(const std::string_view identifier, PoliticalReformGroup const* group, size_t ordinal);
      IDENTIFIER_REGISTRY_ACCESSORS(PoliticalReform, political_reform)

      //TODO - loaders
   };
}