using GB5Shared.DTO.Framework.Login; using IceImportDAL.DTO.ScheduledImportService; namespace IceImportBLL.ScheduledImportService; // Phase 4 — FTP/SFTP ingestion, manually callable (recurring trigger deferred pending JobEngine; // see the plan's "Key architecture decisions" #2). RunScheduledImportAsync is the entire // "check the remote source now" operation: list -> filter unprocessed -> download -> stage -> // enqueue -> kick off the SAME IIceImportRunExecutionService pipeline CommitImport uses -> mark // processed -> post-process. It takes no dependency on SysJob/JobEngine — just an ordinary // BLL method an HTTP endpoint (or, later, a JobEngine job, with zero rework) can call directly. // // Design choice — orchestration option (a): this service itself injects IServiceScopeFactory and // fires one background Task.Run per enqueued run immediately after that file's EnqueueRunAsync // succeeds, rather than pushing a per-file kickoff loop out to the RunScheduledImport endpoint // (option (b), CommitImport's convention for its single-file case). Rationale: every collaborator // this needs (IRemoteFileSource, IIceMapFtpSourceDAL, IIceImportUploadStagingService, // IIceImportRunBLL) already lives in this BLL service; forcing the SL endpoint to replicate a // multi-file version of CommitImport's staging+enqueue+kickoff dance would duplicate this same // per-file orchestration one layer up for no benefit, and BLL-owned IServiceScopeFactory already // has precedent elsewhere in this repo (GB5Solution/TMS/TMSBLL's DI registration, // FLSBLL.Handlers.FlsReminderJobHandler, AnalyticsBLL.OEE.OEENightlyJob). public interface IScheduledImportService { Task RunScheduledImportAsync( int iceMapId, string triggeredBy, LoginDTO login, CancellationToken ct); }