using System.Data.Common;
namespace ScadaLink.Commons.Interfaces.Services;
///
/// Interface for database access from scripts.
/// Implemented by ExternalSystemGateway, consumed by ScriptRuntimeContext.
///
public interface IDatabaseGateway
{
///
/// Returns an ADO.NET DbConnection (typically SqlConnection) from the named connection.
/// Connection pooling is managed by the underlying provider.
/// Caller is responsible for disposing.
///
Task GetConnectionAsync(
string connectionName,
CancellationToken cancellationToken = default);
///
/// Submits a SQL write to the store-and-forward engine for reliable delivery.
///
Task CachedWriteAsync(
string connectionName,
string sql,
IReadOnlyDictionary? parameters = null,
string? originInstanceName = null,
CancellationToken cancellationToken = default);
}