// src/interfaces/drone-monitor.ts
// Copyright (C) 2026 Rob Colbert <rob.colbert@openplatform.us>
// Licensed under the Apache License, Version 2.0

import { HydratedDocument } from "mongoose";
import { GadgetId } from "../lib/gadget-id.ts";
import { IDroneRegistration } from "./drone-registration.ts";

export interface IMemoryMonitor {
  count: number;
  bytes: number;
}

export interface IDroneMonitor {
  _id: GadgetId;
  registration: IDroneRegistration | GadgetId;
  timestamp: Date;
  memory: {
    rss: number;
    v8: {
      heapTotal: number;
      heapUsed: number;
      heapExternal: number;
    };
    os: {
      total: number;
      free: number;
    };
    ai: {
      subagents: IMemoryMonitor;
      fileOperations: IMemoryMonitor;
      toolCalls: IMemoryMonitor;
    };
    logs: IMemoryMonitor;
  };
}

export type DroneMonitorDocument = HydratedDocument<IDroneMonitor>;
