using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using GB5Shared.DTO.Framework.Login;
using GB5Shared.DTO.Promotion;
namespace FrameworkBLL.Promotion
{
// ============================================================
// IPromotionBLL — the shared logic behind both the direct, synchronous
// "Export Package" HTTP endpoint and PromotionExportNodeExecutor (kept as a
// valid GOP node for a possible future scheduled/automated export trigger,
// but not the primary path — a file-download endpoint needs its result
// synchronously, and GOP execution is deliberately async/queued, so Export
// calls this directly rather than going through GopQueueBLL.SubmitExecution).
// ============================================================
public interface IPromotionBLL
{
/// Resolves the IPromotableEntity for entityTypeCode, exports the row +
/// its known children, and validates it — throws InvalidOperationException if
/// blocked (a validation block is a permanent failure, never worth retrying).
Task BuildExportBundleAsync(
string entityTypeCode, int originEntityId, LoginDTO login, CancellationToken ct);
/// Wraps one or more bundles in a manifest and encrypts it to
/// destinationEnvironmentCode's registered public key. Returns the raw package
/// bytes ready to stream as a file download.
Task BuildPackageAsync(
IReadOnlyList items, string destinationEnvironmentCode,
LoginDTO login, CancellationToken ct);
/// Decrypts an uploaded package with this deployment's own private key and
/// returns its manifest (one or more bundles) for the caller to submit into GOP's
/// Ingest flow, one execution per item.
Task OpenPackageAsync(
byte[] encryptedPackage, CancellationToken ct);
/// Returns the registered MPROMOTABLEENTITYTYPE rows (active only), serialized
/// as a JSON string — for populating the Export Package screen's entity-type dropdown.
Task GetSelectListPromotableEntityType(LoginDTO login, CancellationToken ct);
}
}