using DodoSSH.Client.Domain;
using DodoSSH.Client.Storage;
namespace DodoSSH.Client.Sync;
///
/// The snippets in this vault, decrypted, with unpushed local changes laid over them.
///
///
/// The sixth facade over the same generic repository. Nothing here is on the terminal's write path: a snippet
/// is read when the screen that lists them opens, and inserting one hands text to the renderer rather than
/// coming back through the vault.
///
public sealed class SnippetRepository(
ItemStore items,
OutboxStore outbox,
VaultKeyring keyring,
IActivityLogSink? activity = null)
{
private readonly VaultItemRepository snippets =
new(SnippetKind.Instance, items, outbox, keyring, activity);
///
public Task> ListAsync(
Guid vaultId,
CancellationToken cancellationToken) =>
snippets.ListAsync(vaultId, cancellationToken);
///
public Task CreateAsync(
Guid vaultId,
SnippetSecret snippet,
CancellationToken cancellationToken) =>
snippets.CreateAsync(vaultId, snippet, cancellationToken);
///
public Task UpdateAsync(
Guid vaultId,
Guid entityId,
SnippetSecret snippet,
CancellationToken cancellationToken) =>
snippets.UpdateAsync(vaultId, entityId, snippet, cancellationToken);
///
///
/// What sharing a snippet is, underneath. A snippet has no group, no tags and no key binding — see
/// — so unlike a host it crosses whole: nothing about it points at an item
/// of the vault it is leaving, and there is consequently nothing to strip on the way across.
///
public Task MoveAsync(
Guid fromVaultId,
Guid toVaultId,
Guid entityId,
SnippetSecret snippet,
CancellationToken cancellationToken) =>
snippets.MoveAsync(fromVaultId, toVaultId, entityId, snippet, cancellationToken);
///
public Task DeleteAsync(Guid vaultId, Guid entityId, CancellationToken cancellationToken) =>
snippets.DeleteAsync(vaultId, entityId, cancellationToken);
}