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

import { GadgetId } from "../lib/gadget-id.ts";

export interface SubProcessStat {
  pid: number;
  command: string;
  args: string[];
  projectId: GadgetId;
  projectSlug: string;
  projectName: string;
  status: "running" | "stopped" | "error";
  createdAt: string;
  updatedAt: string;
  stdoutFileName: string;
  stderrFileName: string;
}

export type RequestProcessStatsCallback = (
  success: boolean,
  data?: { processes?: SubProcessStat[]; message?: string },
) => void;

export type RequestProcessStatsMessage = (
  registrationId: string,
  cb: RequestProcessStatsCallback,
) => void;

export type SubscribeDroneMessage = (
  registrationId: string,
  cb: (success: boolean) => void,
) => void;

export type UnsubscribeDroneMessage = (
  registrationId: string,
  cb: (success: boolean) => void,
) => void;
