using AIStudio.Chat;
namespace AIStudio.Assistants.VisualBriefing;
///
/// Holds prepared source inputs and owns their temporary optimized attachment files.
///
internal sealed class VisualBriefingPreparedSources : IAsyncDisposable
{
///
/// Gets or initializes the temporary directory.
///
internal string TemporaryDirectory { get; init; } = string.Empty;
///
/// Gets or initializes model attachments.
///
internal IReadOnlyList Attachments { get; init; } = [];
///
/// Gets or initializes transcript sections keyed by stable source ID.
///
internal IReadOnlyDictionary Transcripts { get; init; } = new Dictionary();
///
/// Gets or initializes prepared visual assets.
///
internal IReadOnlyDictionary Assets { get; init; } = new Dictionary(StringComparer.Ordinal);
///
/// Gets or initializes the current source fingerprint.
///
internal string SourceFingerprint { get; init; } = string.Empty;
///
/// Deletes temporary optimized attachment files on a best-effort basis.
///
/// A completed value task.
public ValueTask DisposeAsync()
{
try
{
if (!string.IsNullOrWhiteSpace(this.TemporaryDirectory) &&
Directory.Exists(this.TemporaryDirectory))
Directory.Delete(this.TemporaryDirectory, recursive: true);
}
catch
{
// Temporary optimized visual assets are cleaned up best effort.
}
return ValueTask.CompletedTask;
}
}