namespace MarketingDAL.DTO.Product;
///
/// MarketMind AI master data — a Product (MMKTPRODUCT), scored for the same effort/return
/// portfolio analysis GEF/SalesMind apply to ICPs, but on the product side (delivery/margin/
/// operational effort rather than lead-gen/sales-conversion effort).
///
/// RESOLVED (2026-09-02): this table always carries its own ProductCode/ProductName so it works
/// standalone, but optionally anchors to a tenant's real product-line master via
/// / — a soft reference (no cross-module FK
/// constraint) rather than a hard FK to any single master, because different tenants have
/// different real "product" sources. MITEM (Materials Management's leaf/transactable item — GB5
/// has no separate SKU table, MITEM *is* the SKU level) is deliberately NOT the default anchor:
/// scoring every SKU variant individually is noisier than the ABCD/effort framework is meant to
/// carry. MITEMGROUP ("product line", e.g. "Hospitality Linen"/"Workwear Fabrics") is the
/// recommended anchor for a manufacturing tenant — it matches the altitude the reference material
/// actually scores at. MITEMCATEGORY is available for a tenant that only wants a handful of
/// top-level buckets. EntitlementPlan covers GoodBooks' own SaaS product catalog, which has no MM
/// Item at all. SourceType=Standalone (0) is the default — a tenant with no formal catalog can
/// still use this table on its own.
///
///
public class ProductDTO
{
#region Product
public int ProductId { get; set; }
public string ProductCode { get; set; } = string.Empty;
public string ProductName { get; set; } = string.Empty;
/// 1-10 — see CK_MMKTPRODUCT_DELIVERYEFFORTSCORE.
public byte DeliveryEffortScore { get; set; }
/// 1-10 — see CK_MMKTPRODUCT_RETURNSCORE.
public byte ReturnScore { get; set; }
public decimal MarginPercent { get; set; }
/// 1-10 — single combined score covering procurement + production + packaging +
/// delivery + service effort (not five separate columns, per the reference material).
/// See CK_MMKTPRODUCT_OPERATIONALEFFORTSCORE.
public byte OperationalEffortScore { get; set; }
///
/// Derived, not user-editable: "Easy-to-Buy" | "Primary" | "High-Value" | "Time-Waster".
/// Computed by ProductBLL.ComputeProductLabel on every save.
///
public string ProductLabel { get; set; } = string.Empty;
///
/// Which real master (if any) this product profile anchors to.
/// 0=Standalone, 1=MItem, 2=MItemGroup (recommended default for a manufacturing tenant),
/// 3=MItemSubCategory, 4=MItemCategory, 5=EntitlementPlan. See CK_MMKTPRODUCT_SOURCETYPE.
///
public byte SourceType { get; set; }
///
/// The referenced record's PK in whichever table names — a soft
/// reference, deliberately NOT FK-constrained (Marketing must not take a hard schema
/// dependency on MM/Entitlement's tables). -1 = none (matches SourceType=Standalone).
///
public int SourceRefId { get; set; } = -1;
#endregion
#region Base
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public string? CreatedByName { get; set; }
public int ModifiedById { get; set; }
public DateTime ModifiedOn { get; set; }
public string? ModifiedByName { get; set; }
#endregion
#region Standard
public short SortOrder { get; set; }
public byte Status { get; set; }
public short Version { get; set; }
public int TenantId { get; set; }
#endregion
}