Files
jdescopingtool/NEW/src/Utils/JdeScoping.ConfigManager/Models/PipelineModel.cs
T
Joseph Doherty e5fe2f06e9 feat: add startup config validation and document ConfigManager pipeline editor
Add ConfigurationValidationRunner with IConfigurationValidator interface for
validating required settings at startup. Includes SecureStore and LDAP validators.
Expand ConfigManager with pipeline editing UI, dialogs, and step editors.
Update documentation with config validation guidance.
2026-01-21 17:47:15 -05:00

216 lines
6.6 KiB
C#

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