/**
 * Copyright (c) 2024 Opal Kelly Incorporated
 *
 * This source code is licensed under the FrontPanel license.
 * See the LICENSE file found in the root directory of this project.
 */

import IDevice from "./IDevice";

import { IDeviceEvent } from "./IDeviceEvent";

/**
 * Interface that provides the methods that may be used to open a
 * device and start/stop monitoring device connection/disconnection
 * events.
 */
interface IDeviceManager {
    /**
     * Retrieves an interface to a specific device identified by its
     * serial number.
     * @param {string} serialNumber - The serial number of the device.
     * @returns {Promise<IDevice>} - A promise that resolves to an
     * interface for the Device.
     */
    openDevice(serialNumber: string): Promise<IDevice>;

    /**
     * Starts monitoring for device connection and disconnection events.
     * @returns {Promise<boolean>} - A promise that resolves to True if
     * device monitoring was started successfully, otherwise false.
     */
    startMonitoring(): Promise<boolean>;

    /**
     * Stops monitoring for device connection and disconnection events.
     * @returns {Promise<boolean>} - A promise that resulves to True if
     * device monitoring was stopped successfully, otherwise false.
     */
    stopMonitoring(): Promise<boolean>;

    /**
     * Event that notifies subscribers when a Device has been connected.
     */
    get deviceConnectedEvent(): IDeviceEvent;

    /**
     * Event that notifies subscribers when a Device has been disconnected.
     */
    get deviceDisconnectedEvent(): IDeviceEvent;
}

export default IDeviceManager;
