namespace JdeScoping.ConfigManager.Models;
///
/// Root model for pipelines.json configuration.
///
public class PipelinesConfigModel
{
///
/// Gets or sets the pipeline settings.
///
public PipelineSettings Settings { get; set; } = new();
///
/// Gets or sets the default schedules for all pipelines.
///
public ScheduleDefaults ScheduleDefaults { get; set; } = new();
///
/// Gets or sets the collection of named pipelines.
///
public Dictionary Pipelines { get; set; } = new();
}
public class PipelineSettings
{
///
/// Gets or sets the timezone for scheduling operations.
///
public string Timezone { get; set; } = "UTC";
}
public class ScheduleDefaults
{
///
/// Gets or sets the default mass data refresh schedule.
///
public ScheduleModel Mass { get; set; } = new() { Enabled = true, IntervalMinutes = 10080, PrePurge = true, ReIndex = true };
///
/// Gets or sets the default daily data refresh schedule.
///
public ScheduleModel Daily { get; set; } = new() { Enabled = true, IntervalMinutes = 1440 };
///
/// Gets or sets the default hourly data refresh schedule.
///
public ScheduleModel Hourly { get; set; } = new() { Enabled = true, IntervalMinutes = 60 };
}
public class PipelineModel
{
///
/// Gets or sets the source configuration for data extraction.
///
public PipelineSource Source { get; set; } = new();
///
/// Gets or sets the schedule configurations for this pipeline.
///
public PipelineSchedules Schedules { get; set; } = new();
///
/// Gets or sets optional data transformers applied between source and destination.
///
public List? Transformers { get; set; }
///
/// Gets or sets the destination configuration for data loading.
///
public PipelineDestination Destination { get; set; } = new();
///
/// Gets or sets optional scripts to execute before pipeline starts.
///
public string[]? PreScripts { get; set; }
///
/// Gets or sets optional scripts to execute after pipeline completion.
///
public string[]? PostScripts { get; set; }
}
public class PipelineSource
{
///
/// Gets or sets the source database connection name.
/// Used for database sources.
///
public string Connection { get; set; } = string.Empty;
///
/// Gets or sets the query to extract data from the source.
/// Used for database sources.
///
public string Query { get; set; } = string.Empty;
///
/// Gets or sets the optional mass query for full data extraction.
/// Used for database sources.
///
public string? MassQuery { get; set; }
///
/// Gets or sets the query parameters and their definitions.
/// Used for database sources.
///
public Dictionary Parameters { get; set; } = new();
///
/// Gets or sets the file name for file-based sources.
/// Used for Protobuf+Zstd files.
///
public string? FileName { get; set; }
}
public class ParameterDefinition
{
///
/// Gets or sets the parameter name.
///
public string Name { get; set; } = string.Empty;
///
/// Gets or sets the optional parameter format string.
///
public string? Format { get; set; }
///
/// Gets or sets the optional parameter source or derivation logic.
///
public string? Source { get; set; }
}
public class PipelineSchedules
{
///
/// Gets or sets the mass refresh schedule for this pipeline.
///
public ScheduleModel? Mass { get; set; }
///
/// Gets or sets the daily refresh schedule for this pipeline.
///
public ScheduleModel? Daily { get; set; }
///
/// Gets or sets the hourly refresh schedule for this pipeline.
///
public ScheduleModel? Hourly { get; set; }
}
public class PipelineDestination
{
///
/// Gets or sets the destination type (BulkImport or BulkMerge).
/// BulkImport truncates and loads; BulkMerge matches and updates.
///
public string Type { get; set; } = "BulkMerge";
///
/// Gets or sets the destination table name.
///
public string Table { get; set; } = string.Empty;
///
/// Gets or sets the columns used to match existing records for updates.
/// Only used for BulkMerge destination type.
///
public string[] MatchColumns { get; set; } = [];
///
/// Gets or sets the columns to exclude from update operations.
/// Only used for BulkMerge destination type.
///
public string[] ExcludeFromUpdate { get; set; } = [];
}
///
/// Represents a data transformer applied between source and destination.
///
public class TransformerModel
{
///
/// Gets or sets the transformer type.
/// Supported types: ColumnDrop, ColumnRename, JdeDate.
///
public string Type { get; set; } = string.Empty;
///
/// Gets or sets the columns affected by this transformer.
/// Used by ColumnDrop (columns to remove) and JdeDate (date/time columns).
///
public List? Columns { get; set; }
///
/// Gets or sets the column mappings for rename operations.
/// Used by ColumnRename: OldName → NewName.
///
public Dictionary? Mappings { get; set; }
///
/// Gets or sets the date column name for JdeDate transformer.
///
public string? DateColumn { get; set; }
///
/// Gets or sets the time column name for JdeDate transformer.
///
public string? TimeColumn { get; set; }
///
/// Gets or sets the output column name for JdeDate transformer.
///
public string? OutputColumn { get; set; }
}