using JdeScoping.DataAccess.Interfaces; using JdeScoping.DataSync.Etl.Destinations; using JdeScoping.DataSync.Dev.Models; using JdeScoping.DataSync.Etl.Pipeline; using JdeScoping.DataSync.Dev.Sources; namespace JdeScoping.DataSync.Dev; /// /// Development ETL pipeline for the WorkCenter table. /// Schema from: Scripts/007_CreateWorkCenterTable.sql /// public static class WorkCenterDevEtl { public static readonly string TableName = "WorkCenter"; public static readonly string CacheFileName = "workcenter.json.zstd"; private static readonly JsonColumnSchema[] Schema = [ new("Code", typeof(string), IsNullable: false), new("Description", typeof(string), IsNullable: true), new("LastUpdateDT", typeof(DateTime), IsNullable: false), ]; public static EtlPipeline Create(IDbConnectionFactory connectionFactory, string cacheFilePath) { ArgumentNullException.ThrowIfNull(connectionFactory); if (string.IsNullOrWhiteSpace(cacheFilePath)) throw new ArgumentException("Cache file path is required.", nameof(cacheFilePath)); return new EtlPipelineBuilder() .WithName($"{TableName}_Dev") .WithSource(new JsonZstdFileSource(cacheFilePath, Schema)) .WithDestination(new DbBulkImportDestination(connectionFactory, TableName)) .Build(); } }