using System.Text.Json.Serialization; namespace EnvelopeGenerator.Web.Models; public record Annotation { public required string Name { get; init; } #region Bound Annotation [JsonIgnore] public string? HorBoundAnnotName { get; init; } [JsonIgnore] public string? VerBoundAnnotName { get; init; } #endregion #region Layout internal double _marginLeft = default; internal double _marginTop = default; internal double _width = default; internal double _height = default; [JsonIgnore] public double MarginLeft { get => _marginLeft; init => _marginLeft = value; } [JsonIgnore] public double MarginTop { get => _marginTop; init => _marginTop = value; } public double Width { get => _width; init => _width = value; } public double Height { get => _height; init => _height = value; } #endregion #region Position public double Left => MarginLeft + (HorBoundAnnot?.HorBoundary ?? 0); public double Top => MarginTop + (VerBoundAnnot?.VerBoundary ?? 0); #endregion #region Boundary [JsonIgnore] public double HorBoundary => Left + Width; [JsonIgnore] public double VerBoundary => Top + Height; #endregion #region BoundAnnot [JsonIgnore] public Annotation? HorBoundAnnot { get; set; } [JsonIgnore] public Annotation? VerBoundAnnot { get; set; } #endregion };