using System.Globalization; using Febe.Core.Storage; namespace Febe.Core.Export; /// /// Settings of one export job (like ImportRunSettings): a row of the setting table each, so the schema /// stays as E1 left it. Cleared when the job completes, is cancelled or deleted. /// internal static class ExportRunSettings { public static string CopyAgainKey(long runId) => string.Create(CultureInfo.InvariantCulture, $"esportazione.lavoro.{runId}.copia-di-nuovo"); /// «Copia di nuovo anche i tolti o superati» was chosen for this job (decision D9). public static async Task GetCopyAgainAsync(ISettingsStore store, long runId, CancellationToken ct) { var text = await store.GetAsync(CopyAgainKey(runId), ct).ConfigureAwait(false); return string.Equals(text?.Trim(), "1", StringComparison.Ordinal); } public static Task SetCopyAgainAsync(ISettingsStore store, long runId, bool value, CancellationToken ct) => store.SetAsync(CopyAgainKey(runId), value ? "1" : null, ct); public static Task ClearAsync(ISettingsStore store, long runId, CancellationToken ct) => store.SetAsync(CopyAgainKey(runId), null, ct); }