]> git.stg.codes - stg.git/blobdiff - projects/sgconf/tariffs.cpp
Ticket. The 'change-policy' parameter adding to the
[stg.git] / projects / sgconf / tariffs.cpp
index 3d63d2a8c6861f1b1fc0a666ef4af972ca9f3f69..c7a4bbc9203539262f92c755cbc4517a840c7146 100644 (file)
@@ -28,6 +28,18 @@ if (level == 0)
 return dash ? std::string(level * 4 - 2, ' ') + "- " : std::string(level * 4, ' ');
 }
 
+std::string ChangePolicyToString(TARIFF::CHANGE_POLICY changePolicy)
+{
+switch (changePolicy)
+    {
+    case ALLOW: return "allow";
+    case TO_CHEAP: return "to_cheap";
+    case TO_EXPENSIVE: return "to_expensive";
+    case DENY: return "deny";
+    }
+return "unknown";
+}
+
 std::string PeriodToString(TARIFF::PERIOD period)
 {
 switch (period)
@@ -214,7 +226,8 @@ std::cout << Indent(level, true) << "name: " << conf.name << "\n"
           << Indent(level)       << "free mb: " << conf.free << "\n"
           << Indent(level)       << "passive cost: " << conf.passiveCost << "\n"
           << Indent(level)       << "traff type: " << TraffTypeToString(conf.traffType) << "\n"
-          << Indent(level)       << "period: " << PeriodToString(conf.period) << "\n";
+          << Indent(level)       << "period: " << PeriodToString(conf.period) << "\n"
+          << Indent(level)       << "change policy: " << CyangePolicyToString(conf.changePolicy) << "\n";
 }
 
 void PrintTariff(const STG::GET_TARIFF::INFO & info, size_t level = 0)
@@ -233,6 +246,7 @@ params.push_back(SGCONF::API_ACTION::PARAM("free", "<free mb>", "\tprepaid traff
 params.push_back(SGCONF::API_ACTION::PARAM("passive-cost", "<cost>", "\tpassive cost"));
 params.push_back(SGCONF::API_ACTION::PARAM("traff-type", "<type>", "\ttraffic type (up, down, up+down, max)"));
 params.push_back(SGCONF::API_ACTION::PARAM("period", "<period>", "\ttarification period (daily, monthly)"));
+params.push_back(SGCONF::API_ACTION::PARAM("change-policy", "<change-policy>", "\ttarification change-policy (allow, to_cheap, to_expensive, deny)"));
 params.push_back(SGCONF::API_ACTION::PARAM("times", "<hh:mm-hh:mm, ...>", "coma-separated day time-spans for each direction"));
 params.push_back(SGCONF::API_ACTION::PARAM("day-prices", "<price/price, ...>", "coma-separated day prices for each direction"));
 params.push_back(SGCONF::API_ACTION::PARAM("night-prices", "<price/price, ...>", "coma-separated night prices for each direction"));