//
// Copyright (c) StellaOps. Licensed under the BUSL-1.1.
//
using StellaOps.Evidence.Pack.Models;
namespace StellaOps.Evidence.Pack;
///
/// Service for creating, signing, and managing evidence packs.
/// Sprint: SPRINT_20260109_011_005 Task: EVPK-002
///
public interface IEvidencePackService
{
///
/// Creates an Evidence Pack from grounding validation results.
///
/// The claims to include in the pack.
/// The evidence items supporting the claims.
/// The subject of the evidence pack.
/// Optional context information.
/// Cancellation token.
/// The created evidence pack.
Task CreateAsync(
IEnumerable claims,
IEnumerable evidence,
EvidenceSubject subject,
EvidencePackContext? context,
CancellationToken cancellationToken);
///
/// Creates an Evidence Pack from a Run's artifacts.
///
/// The run identifier.
/// The subject of the evidence pack.
/// Cancellation token.
/// The created evidence pack.
Task CreateFromRunAsync(
string runId,
EvidenceSubject subject,
CancellationToken cancellationToken);
///
/// Adds evidence items to an existing pack (creates new version).
///
/// The pack identifier.
/// The evidence items to add.
/// Cancellation token.
/// The updated evidence pack (new version).
Task AddEvidenceAsync(
string packId,
IEnumerable items,
CancellationToken cancellationToken);
///
/// Signs an Evidence Pack with DSSE.
///
/// The evidence pack to sign.
/// Cancellation token.
/// The signed evidence pack.
Task SignAsync(
EvidencePack pack,
CancellationToken cancellationToken);
///
/// Verifies a signed Evidence Pack.
///
/// The signed pack to verify.
/// Cancellation token.
/// The verification result.
Task VerifyAsync(
SignedEvidencePack signedPack,
CancellationToken cancellationToken);
///
/// Exports a pack to various formats.
///
/// The pack identifier.
/// The export format.
/// Cancellation token.
/// The exported pack.
Task ExportAsync(
string packId,
EvidencePackExportFormat format,
CancellationToken cancellationToken);
///
/// Gets a pack by ID.
///
/// The tenant identifier.
/// The pack identifier.
/// Cancellation token.
/// The evidence pack, or null if not found.
Task GetAsync(
string tenantId,
string packId,
CancellationToken cancellationToken);
///
/// Lists evidence packs for a tenant.
///
/// The tenant identifier.
/// Optional query parameters.
/// Cancellation token.
/// The list of evidence packs.
Task> ListAsync(
string tenantId,
EvidencePackQuery? query,
CancellationToken cancellationToken);
}
///
/// Query parameters for listing evidence packs.
///
public sealed record EvidencePackQuery
{
/// Gets or sets the subject CVE ID filter.
public string? CveId { get; init; }
/// Gets or sets the subject component filter.
public string? Component { get; init; }
/// Gets or sets the associated run ID filter.
public string? RunId { get; init; }
/// Gets or sets the creation time filter (packs after this time).
public DateTimeOffset? Since { get; init; }
/// Gets or sets the maximum number of results.
public int Limit { get; init; } = 50;
/// Gets or sets the pagination cursor.
public string? Cursor { get; init; }
}