using System; namespace GB5Shared.DTO.GOP { // ───────────────────────────────────────────────────────────── // Mapping engine DTOs — INT primary keys, TENANTID on every row. // // Table → DTO mapping: // MMAPPINGDEFINITION → MappingDefinitionDTO // MMAPPINGVERSION → MappingVersionDTO // MMAPPINGNODE → MappingNodeDTO // // VersionStatus values: // 0 = Draft — editable, not in use by runtime // 1 = Active — locked; exactly one Active per definition // 2 = Archived — superseded by a newer activation // ───────────────────────────────────────────────────────────── public class MappingDefinitionDTO { public int MappingDefinitionId { get; set; } public int TenantId { get; set; } public string MapperCode { get; set; } = string.Empty; public string MapperName { get; set; } = string.Empty; public string SourceSchema { get; set; } = string.Empty; public string TargetSchema { get; set; } = string.Empty; /// Optional — when set, the source payload is expected to conform to this /// GopCanonicalModelDTO's field contract instead of being purely open-ended. public int? SourceCanonicalModelId { get; set; } /// Optional — when set, the target payload is expected to conform to this /// GopCanonicalModelDTO's field contract instead of being purely open-ended. public int? TargetCanonicalModelId { get; set; } public bool IsActive { get; set; } = true; public string Description { get; set; } = string.Empty; public int SortOrder { get; set; } public int Status { get; set; } = 1; // 1=Active public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } } public class MappingVersionDTO { public int MappingVersionId { get; set; } public int MappingDefinitionId { get; set; } public int TenantId { get; set; } public string VersionLabel { get; set; } = string.Empty; /// 0=Draft 1=Active 2=Archived public byte VersionStatus { get; set; } public string? SnapshotJson { get; set; } public DateTime? ActivatedOn { get; set; } public int Status { get; set; } = 1; public int SortOrder { get; set; } public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } } public class MappingNodeDTO { public int MappingNodeId { get; set; } public int MappingVersionId { get; set; } public int TenantId { get; set; } /// /// JSONPath into the source document, OR a FactBag path with the /// "[FactBag]" prefix — e.g. "[FactBag] Lines[0].TaxRate". /// public string SourcePath { get; set; } = string.Empty; /// JSONPath into the target document — e.g. "$.TaxAmount". public string TargetPath { get; set; } = string.Empty; /// /// Optional transform key, optionally followed by a colon + argument. /// Examples: "UPPER", "ROUND:2", "FORMAT_DATE:yyyy-MM-dd" /// public string? TransformExpression { get; set; } public int ExecutionOrder { get; set; } public bool IsRequired { get; set; } = true; public int SortOrder { get; set; } public int Status { get; set; } = 1; } }