using GB5Shared.DTO.Framework.Login; namespace IceImportBLL.IceImportRun; // Orchestrates a single tracked run end-to-end: Parse -> MapAndTransform -> Validate -> Commit // (via IIceImportPipeline), updating ICEIMPORT.TICEIMPORTRUN as it goes (via IIceImportRunBLL), // pushing live progress (via IIceImportRunNotifier), and always reaching a terminal CompleteRunAsync // call no matter what happens — this is the method a freshly-scoped background Task resolves and // calls, per CommitImport/RetryImportRun's "new IServiceScopeFactory scope, not the request scope" // pattern (mirroring FrameworkBLL.DataSync.DataSyncRunBLL.RunBackgroundAsync). // // Exactly one of uploadToken / sourceStorageKey must be supplied: // - CommitImport passes the client's UploadToken (re-validated via IIceImportUploadStagingService // inside a fresh scope — the request's own opened stream is never handed across scope // boundaries). // - RetryImportRun passes the original run's "SourceFile" artifact StorageKey directly (no token // exists for a retry — the original upload token may have long since expired). public interface IIceImportRunExecutionService { Task ExecuteTrackedRunAsync( long runId, int iceMapId, string? uploadToken, string? sourceStorageKey, LoginDTO login, CancellationToken ct); // "/IceImport/Update" path — same Parse/MapAndTransform/Validate stages and abort-on-error // policy as ExecuteTrackedRunAsync, but MapAndTransformAsync runs with isUpdateMode: true // (ValueType 8/9 resolve) and Commit calls IIceImportPipeline.CommitAsUpdateAsync (a dynamic // UPDATE statement against the physical table) instead of the Menu/WebService dispatch // ExecuteTrackedRunAsync uses. Task ExecuteTrackedUpdateRunAsync( long runId, int iceMapId, string uploadToken, LoginDTO login, CancellationToken ct); }