using System;
using XP.Common.License.Enums;
using XP.Common.License.Implementations;
namespace XP.Common.License.Interfaces;
///
/// 授权服务接口 | License service interface
///
public interface ILicenseService
{
///
/// 执行授权检查 | Perform authorization check
///
/// 授权检查结果 | License check result
LicenseCheckResult CheckAuthorization();
///
/// 当前会话是否已授权 | Whether the current session is authorized
///
bool IsAuthorized { get; }
///
/// 获取授权到期日期 | Get license expiration date
///
/// 授权到期日期,未授权时返回 null | License expiration date, null if not authorized
DateTime? GetExpirationDate();
///
/// 检查模块是否授权 | Check if module is licensed
///
/// 模块ID | Module ID
/// 模块是否授权 | Whether the module is licensed
bool IsModuleLicensed(ushort moduleId);
///
/// 获取SMA到期日期 | Get SMA expiration date
///
/// SMA到期日期,未启用时返回 null | SMA expiration date, null if not enabled
DateTime? GetSmaDate();
///
/// 当前授权模式 | Current license mode
///
LicenseMode LicenseMode { get; }
///
/// 临时测试模式超时事件(到期时触发,应用应执行正常关闭流程)| Temporary test mode timeout event (fires when expired, app should perform graceful shutdown)
///
event EventHandler TestModeTimeout;
///
/// 临时测试模式剩余5分钟警告事件 | Temporary test mode 5-minute warning event
///
event EventHandler TestModeWarning5Min;
///
/// 临时测试模式剩余1分钟警告事件 | Temporary test mode 1-minute warning event
///
event EventHandler TestModeWarning1Min;
///
/// 获取临时测试模式剩余时间 | Get remaining time in temporary test mode
///
/// 剩余时间(秒),非测试模式返回 0 | Remaining time in seconds, 0 if not in test mode
int GetRemainingTestTime();
}