using System;
namespace AnalyticsDAL.DTO.BIView
{
/// Maps one row of MBIVIEW — a saved Dimension/Measure/WidgetType definition over
/// one MBICATALOG dataset. Mirrors MREPORT (1) <-> MREPORTVIEW (many): one catalog can
/// back many views (e.g. a KPI total and a separate region-by-month pivot, both over the
/// same catalog). Deliberately independent of MPORTLET — a Portlet placement only ever
/// points at a BIViewId (nullable FK), it never owns the view's definition.
public class BIViewDTO
{
public int BIViewId { get; set; }
public int BICatalogId { get; set; }
public string BIViewCode { get; set; } = string.Empty;
public string BIViewName { get; set; } = string.Empty;
/// The exact FE wire string: 'kpi-card' | 'apex-chart' | 'table' | 'pivot-table'.
public string WidgetType { get; set; } = string.Empty;
/// Serialized AnalysisQueryDefinition (Dimensions/Measures/Filters/Rows/Columns/Sort/TopN).
public string BIDefinitionJson { get; set; } = string.Empty;
/// Serialized GB5WidgetAdapterConfig (chartSubType/colors/height) plus, for
/// pivot-table views, the saved WebDataRocks slice from the "save current layout"
/// action (Phase 5) — null until a view has ever been saved with a customized layout.
public string? AdapterConfigJson { get; set; }
/// Mirrors MREPORTVIEW.SOURCETYPE: 1 Framework, 2 DevAdmin, 3 ImpAdmin, 4 Admin, 5 User.
public byte SourceType { get; set; }
/// Ownership sentinel — -1 shared/global, matching MBICATALOG/MWORKSPACE/MDATASOURCE.
public int TenantId { get; set; }
public short Version { get; set; }
public byte Status { get; set; }
public short SortOrder { get; set; }
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public int ModifiedById { get; set; }
public DateTime ModifiedOn { get; set; }
}
}