// Copyright (c) Microsoft. All rights reserved. using System; using Microsoft.Extensions.Compliance.Redaction; using Microsoft.Shared.Diagnostics; namespace Microsoft.Agents.AI; /// /// A that replaces the entire input with a fixed replacement string. /// internal sealed class ReplacingRedactor : Redactor { private readonly string _replacementText; /// /// Initializes a new instance of the class. /// /// The text to substitute for any input value. /// Thrown when is . public ReplacingRedactor(string replacementText) { this._replacementText = Throw.IfNull(replacementText); } /// public override int GetRedactedLength(ReadOnlySpan input) => this._replacementText.Length; /// public override int Redact(ReadOnlySpan source, Span destination) { this._replacementText.AsSpan().CopyTo(destination); return this._replacementText.Length; } }