using System.Threading; using System.Threading.Tasks; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Promotion; namespace GB5Shared.Promotion { // ============================================================ // IPromotableEntity — one implementation per promotable entity type // (Menu, PortletType, Page, Dashboard today; Report/Analysis/BIView next). // // Lives in GB5Shared (not FrameworkBLL) because implementations span two // separate solutions/assemblies — GB5Framework's own entity BLLs // (MenuBLL, PortletTypeBLL, ...) and GB5Solution/Analytics's AnalyticsBLL // (AnalysisObjectBLL, AnalysisQueryBLL, ...) — mirroring how GOP's own // shared DTOs live in GB5Shared/DTO/GOP rather than inside FrameworkBLL. // // Registered as keyed scoped services, resolved by EntityTypeCode: // services.AddKeyedScoped("MENU"); // services.AddKeyedScoped("PORTLETTYPE"); // Same pattern as GOP's own INodeExecutor keyed-DI registration. // ============================================================ public interface IPromotableEntity { /// Matches MPROMOTABLEENTITYTYPE.ENTITYTYPECODE for this type (e.g. "MENU"). string EntityTypeCode { get; } /// Reads the row + its known children locally, via this deployment's own /// IQueryExecutor — never cross-deployment. Called at the origin, inside the /// PromotionExportNodeExecutor step. Task ExportForPromotionAsync( int originEntityId, LoginDTO login, CancellationToken ct); /// Re-run at both export time (fail fast for the submitter) and ingest time /// (never trust only the origin's copy) — checks addon-field references, hardcoded /// tenant literals, and any entity-specific non-promotable content. Task ValidateForPromotionAsync( PromotionBundleDTO bundle, CancellationToken ct); /// Calls this entity's own existing Save method with SourceType forced to /// destinationSourceType (2=DevAdmin or 3=ImpAdmin). When existingDestinationId is set /// (a re-promotion matched via MPROMOTIONASSETLINK), performs an update against that ID /// instead of a fresh insert. Returns the destination's own entity ID (new or existing). Task ImportPromotedAsync( PromotionBundleDTO bundle, byte destinationSourceType, int? existingDestinationId, LoginDTO login, CancellationToken ct); } }