using ZB.MOM.WW.ScadaBridge.Commons.Types.Transport;
namespace ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Transport;
public interface IBundleImporter
{
///
/// Validates and decrypts the bundle stream, opens a session, and returns session metadata.
///
/// Stream containing the bundle zip archive.
/// Optional passphrase for decrypting an encrypted bundle.
/// Cancellation token.
/// A task that resolves to session metadata for the loaded bundle.
Task LoadAsync(Stream bundleStream, string? passphrase, CancellationToken ct = default);
///
/// Diffs the loaded bundle against the target database and returns a per-artifact preview.
///
/// Session id returned by .
/// Cancellation token.
/// A task that resolves to a per-artifact import preview with conflict details.
Task PreviewAsync(Guid sessionId, CancellationToken ct = default);
///
/// Applies the chosen conflict resolutions and commits the import transaction.
///
/// Session id returned by .
/// Per-artifact conflict resolutions from the preview step.
/// Username of the operator performing the import, stamped in audit rows.
/// Cancellation token.
///
/// The operator-supplied resolution of every source-environment site and connection
/// name the bundle references (M8 D1). Each entry is either
/// (bind to an existing target site/connection)
/// or (create one from the bundle payload). A
/// site or connection that the bundle references but that has no explicit entry here is
/// auto-matched against the target by identity (existing → MapToExisting, otherwise
/// CreateNew). Trailing optional parameter — null is normalised to
/// so callers that carry no site/instance payload
/// (e.g. central-config-only bundles) keep working unchanged.
///
/// A task that resolves to the result of the committed import transaction.
Task ApplyAsync(
Guid sessionId,
IReadOnlyList resolutions,
string user,
CancellationToken ct = default,
BundleNameMap? nameMap = null);
}