// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Microsoft.Shared.Diagnostics;
namespace Microsoft.Extensions.DataIngestion;
///
/// Represents the result of an ingestion operation.
///
public sealed class IngestionResult
{
///
/// Gets the ID of the document that was ingested.
///
public string DocumentId { get; }
///
/// Gets the ingestion document created from the source file, if reading the document has succeeded.
///
public IngestionDocument? Document { get; }
///
/// Gets the exception that occurred during ingestion, if any.
///
public Exception? Exception { get; }
///
/// Gets a value indicating whether the ingestion succeeded.
///
public bool Succeeded => Exception is null;
internal IngestionResult(string documentId, IngestionDocument? document, Exception? exception)
{
DocumentId = Throw.IfNullOrEmpty(documentId);
Document = document;
Exception = exception;
}
}