172 lines
6.3 KiB
C#
172 lines
6.3 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace DocumentAutomation.Shared;
|
|
|
|
public sealed record InspectionWarning
|
|
{
|
|
public required string Code { get; init; }
|
|
public required string Message { get; init; }
|
|
public string? Part { get; init; }
|
|
public string? Location { get; init; }
|
|
public string? MatchedValue { get; init; }
|
|
public string? DetectionRule { get; init; }
|
|
}
|
|
|
|
public sealed record DocumentFieldInfo
|
|
{
|
|
public required string Type { get; init; }
|
|
public required string Part { get; init; }
|
|
public int? Section { get; init; }
|
|
public string? Instruction { get; init; }
|
|
}
|
|
|
|
public sealed record DocumentImageSummary
|
|
{
|
|
public int RasterImages { get; init; }
|
|
public int DrawingObjects { get; init; }
|
|
public int VmlShapes { get; init; }
|
|
public int ExternalImages { get; init; }
|
|
}
|
|
|
|
public sealed record DocumentStyleInfo
|
|
{
|
|
public required string StyleId { get; init; }
|
|
public string? Name { get; init; }
|
|
public string? Type { get; init; }
|
|
public bool IsDefault { get; init; }
|
|
public string? BasedOn { get; init; }
|
|
public string? LinkedStyle { get; init; }
|
|
public int UsageCount { get; init; }
|
|
}
|
|
|
|
public sealed record SectionPartAssignment
|
|
{
|
|
public required int Section { get; init; }
|
|
public IReadOnlyList<string> Headers { get; init; } = [];
|
|
public IReadOnlyList<string> Footers { get; init; } = [];
|
|
public bool LinkToPrevious { get; init; }
|
|
}
|
|
|
|
public sealed record InsertionPointInfo
|
|
{
|
|
public required string Type { get; init; }
|
|
public string? Location { get; init; }
|
|
}
|
|
|
|
public enum SectionBreakPolicy { Remove, ConvertToParagraph, ConvertToPageBreak }
|
|
public enum RevisionImportPolicy { PreserveAndWarn, AcceptAll, RejectAll, BlockImport }
|
|
public enum CommentImportPolicy { PreserveAndWarn, Exclude, BlockImport }
|
|
public enum StyleConflictPolicy { KeepSourceFormatting, UseDestinationStyles, MapKnownStyles }
|
|
|
|
public sealed record WordOperationProgress
|
|
{
|
|
public required string Stage { get; init; }
|
|
public string? Message { get; init; }
|
|
public int? Percent { get; init; }
|
|
}
|
|
|
|
public sealed record BodyImportPlan
|
|
{
|
|
public required int ParagraphCount { get; init; }
|
|
public required int TableCount { get; init; }
|
|
public required int InlineShapeCount { get; init; }
|
|
public required int FloatingShapeCount { get; init; }
|
|
public required int InternalSectionBreakCount { get; init; }
|
|
public required int PageBreakCount { get; init; }
|
|
public required IReadOnlyList<string> IncludedStories { get; init; }
|
|
public required IReadOnlyList<string> ExcludedStories { get; init; }
|
|
public required IReadOnlyList<string> Warnings { get; init; }
|
|
}
|
|
|
|
public sealed record DocxBodyImportRequest
|
|
{
|
|
public required string SourcePath { get; init; }
|
|
public required object DestinationRangeHandle { get; init; }
|
|
public SectionBreakPolicy SectionBreakPolicy { get; init; } = SectionBreakPolicy.ConvertToPageBreak;
|
|
public RevisionImportPolicy RevisionPolicy { get; init; } = RevisionImportPolicy.PreserveAndWarn;
|
|
public CommentImportPolicy CommentPolicy { get; init; } = CommentImportPolicy.Exclude;
|
|
public StyleConflictPolicy StyleConflictPolicy { get; init; } = StyleConflictPolicy.KeepSourceFormatting;
|
|
}
|
|
|
|
public sealed record BodyImportResult
|
|
{
|
|
public required BodyImportPlan Plan { get; init; }
|
|
public required string InsertionMode { get; init; }
|
|
public required IReadOnlyList<string> Warnings { get; init; }
|
|
}
|
|
|
|
public sealed record DocumentInspectionResult
|
|
{
|
|
public required string FilePath { get; init; }
|
|
public long FileSize { get; init; }
|
|
public DateTime LastWriteTimeUtc { get; init; }
|
|
public int Sections { get; init; }
|
|
public int Paragraphs { get; init; }
|
|
public int Tables { get; init; }
|
|
public int Images { get; init; }
|
|
public DocumentImageSummary ImageSummary { get; init; } = new();
|
|
public int Headers { get; init; }
|
|
public int Footers { get; init; }
|
|
public bool HasPageFields { get; init; }
|
|
public bool HasNumPagesFields { get; init; }
|
|
public bool HasSectionPagesFields { get; init; }
|
|
public IReadOnlyList<DocumentFieldInfo> Fields { get; init; } = [];
|
|
public int Bookmarks { get; init; }
|
|
public int ContentControls { get; init; }
|
|
public int Comments { get; init; }
|
|
public bool HasTrackedChanges { get; init; }
|
|
public bool HasProtectedParts { get; init; }
|
|
public IReadOnlyList<DocumentStyleInfo> StyleDetails { get; init; } = [];
|
|
public IReadOnlyList<SectionPartAssignment> SectionAssignments { get; init; } = [];
|
|
public InsertionPointInfo InsertionPoint { get; init; } = new() { Type = "None" };
|
|
public BodyImportPlan? BodyImportPlan { get; init; }
|
|
public IReadOnlyList<InspectionWarning> Warnings { get; init; } = [];
|
|
public IReadOnlyList<string> Styles => StyleDetails.Select(x => x.StyleId).ToArray();
|
|
}
|
|
|
|
public sealed record WordDocumentBuildRequest
|
|
{
|
|
public required string TemplatePath { get; init; }
|
|
public required string BodyPath { get; init; }
|
|
public required string OutputDocxPath { get; init; }
|
|
public string? RulesProfilePath { get; init; }
|
|
public bool PreserveBodyFormatting { get; init; } = true;
|
|
public bool PreservePageBreaks { get; init; } = true;
|
|
}
|
|
|
|
public sealed record WordDocumentResult
|
|
{
|
|
public required string OutputDocxPath { get; init; }
|
|
public string? OutputPdfPath { get; init; }
|
|
public required string LogPath { get; init; }
|
|
public required TimeSpan Duration { get; init; }
|
|
public required string InsertionPoint { get; init; }
|
|
public BodyImportResult? BodyImport { get; init; }
|
|
}
|
|
|
|
public sealed record WordPreviewResult
|
|
{
|
|
public required string PdfPath { get; init; }
|
|
public required TimeSpan Duration { get; init; }
|
|
}
|
|
|
|
public enum RuleEvaluationStatus { Pass, Fail, NotApplicable, NeedsReview, Error }
|
|
|
|
public sealed record RuleEvaluationResult
|
|
{
|
|
public required string RuleId { get; init; }
|
|
public required RuleEvaluationStatus Status { get; init; }
|
|
public required string Message { get; init; }
|
|
public string? ClauseId { get; init; }
|
|
public int? SourcePage { get; init; }
|
|
public string? DocumentLocation { get; init; }
|
|
public bool CanAutoFix { get; init; }
|
|
}
|
|
|
|
public sealed record OllamaSettings
|
|
{
|
|
public string BaseUrl { get; init; } = "http://192.168.200.112:11434";
|
|
public string Model { get; init; } = "";
|
|
public int TimeoutSeconds { get; init; } = 120;
|
|
}
|