using GB5Shared.DTO.Framework.Login;
using SwDAL.DTO.Provisioning;
namespace SwBLL.Provisioning;
public interface IProvisioningBLL
{
///
/// Provisions a client database by executing all Approved DDL scripts in SEQUENCE order,
/// applying metadata snapshots, and setting the ClientDatabase status to Active (all success)
/// or Failed (any failure). Execution log is written to LSWDDLEXECUTION after each script.
///
Task ProvisionClientDatabase(
int clientDbId, int upgradePackageId, LoginDTO loginDTO, CancellationToken ct);
/// Resolves the currently-applied release version for a ClientDatabaseId: finds the
/// most recently fully-applied package (every DDL line Success-logged, latest status per
/// line), then walks SupersedesPackageId back through its lineage to the nearest package
/// carrying a non-null ReleaseVersion. Returns IsVersioned=false / CurrentReleaseVersion=null
/// when no release-boundary package has ever been applied — a legitimate state, not an error.
/// SqlWorkbench-agnostic: has no knowledge of any GB5-specific table.
Task GetCurrentVersion(int clientDbId, LoginDTO loginDTO, CancellationToken ct);
}