#pragma once
#include <string>
#include <vector>
#include "common/Fields.h"
#include "common/JsonN.h"

class SysPolicy
{
public:
    int policyId {0};

    // 1：峰谷套利，2：配网增容，3：应急供电，4：并网保电，5：自定时段
    int type {0};
    
    std::string name;
    std::string value;
    int isOpen {1};

    Fields fields;

    std::vector<float> vecPrice {0.0f, 0.0f, 0.0f, 0.0f};

    std::vector<std::vector<std::pair<std::string, std::string>>> vecPeriods1;

    void setFields(Fields& fields);

    void parseValue(std::string jsonstr);
    void parseJsonPeriods(njson& json);

    void getGatewayJsonPrice(njson& json);
    void getGatewayJsonPeriods(njson& json);
};