#pragma once

#include <string>
#include <vector>

namespace softbus::core {

enum class ObjectLayer {
    Site = 0,
    System = 1,
    Asset = 2,
    Device = 3,
    Point = 4
};

struct ObjectRef {
    std::string site;
    std::string system;
    std::string asset;
    std::string device;
    std::string point;

    std::string toPath() const;
    static ObjectRef fromPath(const std::string& path);
    bool isValid() const;
    bool hasPoint() const;
};

struct PointDef {
    std::string name;
    int registerAddress{0};
    std::string domain{"Process"};
    std::string signalType{"AI"};
    std::string physicalChannel;
    std::string unit;
    double minValue{0.0};
    double maxValue{100.0};
    std::string access{"read"};
    bool writable{false};
    double scale{1.0};
};

struct DeviceDef {
    std::string stableDeviceKey;
    std::string protocol;
    std::vector<PointDef> points;
};

struct ObjectModelTree {
    std::string site;
    std::string system;
    std::string asset;
    std::vector<DeviceDef> devices;

    bool loadFromFile(const std::string& path);
    bool isValid() const;
};

} // namespace softbus::core
