declare namespace MasterModel { interface SearchMessagePaginationBody extends SearchPaginationBody { subtopic?: string; } interface RawNodeConfig { nid?: string; t?: string; n?: string; e?: E[]; } interface E { eid?: string; t?: string; n?: string; a?: number; v?: number; c?: EC; vs?: string; } interface EC { l?: number; nc?: number; st?: string; c?: CElement[]; } interface CElement { t?: string; c?: PurpleC; } interface PurpleC { eid?: string; v?: number; op?: number; for?: number; } // Interface Tranformed RawNodeConfig interface NodeConfig { /** Node ID - Định danh duy nhất */ nodeId: string; /** Type - Loại thiết bị */ type: string; /** Name - Tên hiển thị */ name: string; /** Entities - Danh sách cảm biến */ entities: Entity[]; } interface Entity { /** Entity ID - Định danh duy nhất của cảm biến */ entityId: string; /** Type - Loại cảm biến (vd: 'bin' - nhị phân 0/1, 'bin_t' - nhị phân có trigger) */ type: string; /** Name - Tên hiển thị */ name: string; /** Active - Đã kích hoạt cảm biến này hay chưa (1=đã kích hoạt, 0=chưa kích hoạt) */ active?: number; /** Value - Giá trị hiện tại (1=có, 0=không) */ value?: number; /** EntityConfig - Cấu hình bổ sung */ config?: EntityConfig[]; } interface EntityConfig { /** Level - Mức độ cảnh báo 0 = info, 1 = warning, 2 = critical */ level?: 0 | 1 | 2; /** Normal Condition - Điều kiện bình thường */ normalCondition?: number; /** SubType - Phân loại chi tiết */ subType?: string; /** Children - Các cấu hình con */ children?: EntityConfigChild[]; } interface EntityConfigChild { /** Type - Loại điều kiện */ type: string; children?: EntityConfigChildDetail[]; } interface EntityConfigChildDetail { /** entity ID - Cảm biến được theo dõi */ entityId: string; /** Value - Ngưỡng giá trị */ value?: number; /** Operation - Toán tử so sánh: * 0 = == (bằng) * 1 = != (khác) * 2 = > (lớn hơn) * 3 = >= (lớn hơn hoặc bằng) * 4 = < (nhỏ hơn) * 5 = <= (nhỏ hơn hoặc bằng) */ operation?: number; /** Duration - Thời gian duy trì (giây) */ duration?: number; } }