using System;

namespace CncService.Interface
{
    // Windows 服务状态枚举，用于和心跳状态区分不同场景
    public enum ServiceStatusEnum
    {
        NotInstalled,
        Stopped,
        Running,
        Starting,
        StartFailed
    }

    /// <summary>
    /// Windows 服务检测接口（用于管理后台对采集服务的状态检测与控制）
    /// </summary>
    public interface IWindowsServiceChecker
    {
        /// <summary>
        /// 获取指定服务的当前状态
        /// </summary>
        /// <param name="serviceName">服务名</param>
        /// <returns>服务状态枚举</returns>
        ServiceStatusEnum GetServiceStatus(string serviceName);

        /// <summary>
        /// 尝试启动指定服务，并在给定超时内等待就绪
        /// </summary>
        /// <param name="serviceName">服务名</param>
        /// <param name="timeoutSeconds">超时（秒）</param>
        /// <returns>(是否成功, 详细信息)</returns>
        (bool Success, string Message) TryStartService(string serviceName, int timeoutSeconds);

        /// <summary>
        /// 尝试停止指定服务，并在给定超时内等待停止
        /// </summary>
        /// <param name="serviceName">服务名</param>
        /// <param name="timeoutSeconds">超时（秒）</param>
        /// <returns>(是否成功, 详细信息)</returns>
        (bool Success, string Message) TryStopService(string serviceName, int timeoutSeconds);
    }
}
