namespace Admin.NET.Plugin.AiDOP.Dto.SmartOps; /// 维度配置读出 DTO。 public sealed class KpiDimensionConfigDto { public long Id { get; set; } public long? TenantId { get; set; } public string MetricCode { get; set; } = string.Empty; public string ModuleCode { get; set; } = string.Empty; public long SummaryConfigId { get; set; } public int SummaryConfigVersion { get; set; } public int DimensionConfigVersion { get; set; } public string? DataSourceCode { get; set; } public string? SqlScript { get; set; } public string AggregationType { get; set; } = "SUMMARY_ONLY"; public string? SupportedDimensionsJson { get; set; } public string? OutputContractJson { get; set; } public string? ParameterContractJson { get; set; } public int TimeoutSeconds { get; set; } public string PublishStatus { get; set; } = "DRAFT"; public bool IsCurrent { get; set; } public string? BusinessSqlSource { get; set; } public string? ChangeRemark { get; set; } public string? Remark { get; set; } public string? CreatedBy { get; set; } public DateTime CreatedAt { get; set; } public string? PublishedBy { get; set; } public DateTime? PublishedAt { get; set; } } /// 维度配置新增/编辑草稿 DTO。 public sealed class KpiDimensionConfigUpsertDto { public string MetricCode { get; set; } = string.Empty; public string ModuleCode { get; set; } = string.Empty; public string? DataSourceCode { get; set; } public string? SqlScript { get; set; } public string AggregationType { get; set; } = "SUMMARY_ONLY"; public string? SupportedDimensionsJson { get; set; } public string? OutputContractJson { get; set; } public string? ParameterContractJson { get; set; } public int TimeoutSeconds { get; set; } public string? BusinessSqlSource { get; set; } public string? ChangeRemark { get; set; } public string? Remark { get; set; } } /// 维度试算入参。 public sealed class KpiDimensionPreviewDto { public string MetricCode { get; set; } = string.Empty; public string ModuleCode { get; set; } = string.Empty; public string? DataSourceCode { get; set; } public string? SqlScript { get; set; } public string AggregationType { get; set; } = "SUMMARY_ONLY"; public int TimeoutSeconds { get; set; } public DateTime? BizDate { get; set; } } /// 维度试算结果(含前 N 行样本 + 契约校验)。 public sealed class KpiDimensionPreviewResultDto { public bool Ok { get; set; } public string MetricCode { get; set; } = string.Empty; public string? DataSourceCode { get; set; } public string BizDate { get; set; } = string.Empty; public string ValidationStatus { get; set; } = string.Empty; public string ResultStatus { get; set; } = string.Empty; public long DurationMs { get; set; } public int RowCount { get; set; } public List OutputColumns { get; set; } = new(); public List SupportedDimensions { get; set; } = new(); public List> SampleRows { get; set; } = new(); public string? ErrorCode { get; set; } public string? ErrorMessage { get; set; } public string ExecutedParameters { get; set; } = string.Empty; } /// KPI 维度能力(驱动前端筛选/下钻可用性)。 public sealed class KpiDimensionCapabilityDto { public string MetricCode { get; set; } = string.Empty; public string ModuleCode { get; set; } = string.Empty; /// 是否已配置并激活维度(PENDING_DIMENSION_SQL 时 false)。 public bool Supported { get; set; } /// 能力状态 PENDING_DIMENSION_SQL / CONFIGURED / SUMMARY_ONLY。 public string CapabilityStatus { get; set; } = "PENDING_DIMENSION_SQL"; public int? SummaryConfigVersion { get; set; } public int? DimensionConfigVersion { get; set; } public List SupportedDimensions { get; set; } = new(); public string? AggregationType { get; set; } public string? LastRunStatus { get; set; } public DateTime? LastRunAt { get; set; } }