feat: scaffold P_Rec_Annot .NET 8 architecture
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
namespace PRecAnnot.Abstractions;
|
||||
|
||||
public sealed record OrthoViewportRef(string DrawingId, string ViewportId);
|
||||
|
||||
public sealed record PlantObjectData
|
||||
{
|
||||
public required string ObjectId { get; init; }
|
||||
public required string ClassName { get; init; }
|
||||
public string? LineNumber { get; init; }
|
||||
public string? Tag { get; init; }
|
||||
public string? DisplayName { get; init; }
|
||||
public required AnnotationPoint Position { get; init; }
|
||||
public double Rotation { get; init; }
|
||||
}
|
||||
|
||||
public readonly record struct AnnotationPoint(double X, double Y, double Z = 0);
|
||||
|
||||
public sealed record ExistingAnnotation(string StableKey, string? Text, AnnotationPoint Position);
|
||||
|
||||
public sealed record AnnotationRequest
|
||||
{
|
||||
public required OrthoViewportRef Viewport { get; init; }
|
||||
public required IReadOnlyList<PlantObjectData> Objects { get; init; }
|
||||
public required IReadOnlyList<ExistingAnnotation> Existing { get; init; }
|
||||
}
|
||||
|
||||
public sealed record AnnotationIntent
|
||||
{
|
||||
public required string StableKey { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required AnnotationPoint Position { get; init; }
|
||||
public required double Rotation { get; init; }
|
||||
public required string ClassName { get; init; }
|
||||
public required string Layer { get; init; }
|
||||
}
|
||||
|
||||
public sealed record AnnotationPlan
|
||||
{
|
||||
public required IReadOnlyList<AnnotationIntent> Create { get; init; }
|
||||
public required IReadOnlyList<AnnotationIntent> Update { get; init; }
|
||||
public required IReadOnlyList<string> Delete { get; init; }
|
||||
public required IReadOnlyList<string> SkipReasons { get; init; }
|
||||
public int ExaminedCount { get; init; }
|
||||
public bool IsDeterministic { get; init; } = true;
|
||||
}
|
||||
|
||||
public interface IPlantProjectContext
|
||||
{
|
||||
bool IsPlantProjectOpen { get; }
|
||||
string? ProjectName { get; }
|
||||
}
|
||||
|
||||
public interface IOrthoDrawingContext
|
||||
{
|
||||
bool IsOrthoDrawing { get; }
|
||||
IReadOnlyList<OrthoViewportRef> GetViewports();
|
||||
}
|
||||
|
||||
public interface IPlantObjectReader
|
||||
{
|
||||
IReadOnlyList<PlantObjectData> ReadObjects(OrthoViewportRef viewport, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface IAnnotationRepository
|
||||
{
|
||||
IReadOnlyList<ExistingAnnotation> FindExisting(OrthoViewportRef viewport);
|
||||
AnnotationWriteResult Apply(AnnotationPlan plan, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public sealed record AnnotationWriteResult(int Created, int Updated, int Deleted, int Skipped);
|
||||
|
||||
public interface IAnnotationRuleEngine
|
||||
{
|
||||
AnnotationPlan BuildPlan(AnnotationRequest request);
|
||||
}
|
||||
|
||||
public sealed record CommandUsageEvent
|
||||
{
|
||||
public required string CommandName { get; init; }
|
||||
public required string ResultStatus { get; init; }
|
||||
public int ObjectsExamined { get; init; }
|
||||
public int AnnotationsCreated { get; init; }
|
||||
public int AnnotationsUpdated { get; init; }
|
||||
public int AnnotationsDeleted { get; init; }
|
||||
public int AnnotationsSkipped { get; init; }
|
||||
public int WarningCount { get; init; }
|
||||
public int ErrorCount { get; init; }
|
||||
public long DurationMilliseconds { get; init; }
|
||||
public DateTimeOffset TimestampUtc { get; init; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public interface ICommandUsageSink
|
||||
{
|
||||
void Record(CommandUsageEvent usageEvent);
|
||||
}
|
||||
Reference in New Issue
Block a user