using Hotline.Share.Dtos.FlowEngine.Definition;

namespace Hotline.FlowEngine.Definitions
{
    public interface IDefinitionDomainService
    {
        Task<string> AddAsync(AddDefinitionDto dto, CancellationToken cancellationToken);

        /// <summary>
        /// 发布流程模板
        /// </summary>
        Task PublishAsync(string id, CancellationToken cancellationToken);

        /// <summary>
        /// 发布（保存并发布）
        /// </summary>
        Task PublishAsync(AddDefinitionDto dto, CancellationToken cancellationToken);

        /// <summary>
        /// 查询最大版本号（含启用、禁用）
        /// </summary>
        /// <param name="code"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<int> GetLastVersionNoAsync(string code, CancellationToken cancellationToken);

        /// <summary>
        /// 查询已启用的最后版本
        /// </summary>
        /// <param name="code"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<WorkflowDefinition?> GetLastVersionAsync(string code, CancellationToken cancellationToken);

        ///// <summary>
        ///// 查询已启用的最后版本
        ///// </summary>
        ///// <param name="moduleCode"></param>
        ///// <param name="cancellationToken"></param>
        ///// <returns></returns>
        //Task<Definition?> GetLastVersionByModuleCodeAsync(string moduleCode, CancellationToken cancellationToken);

        ///// <summary>
        ///// 禁用指定业务模块下所有模板
        ///// </summary>
        //Task EnableAsync(string moduleCode, CancellationToken cancellationToken);
    }
}
