using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RobotNet10.MapManager.Data;
///
/// Editor-specific settings for each layout level
/// NOT part of VDMA LIF standard - UI/Editor extensions only
///
[Table("LayoutLevelEditorSettings")]
public class LayoutLevelEditorSettings
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
///
/// Parent layout level reference (1-to-1 relationship)
///
[Required]
public Guid LevelId { get; set; }
// ==========================================
// EDGE SETTINGS
// ==========================================
///
/// Minimum edge length (in METERS) required to create an edge
/// Prevents accidental creation of very short edges
/// Default: 0.1 meters (10 cm)
///
[Required]
public double EdgeMinLengthCreate { get; set; } = 0.5;
///
/// Auto-generate edge names when creating new edges
/// Uses 8-character GUID: "Edge_a7f2e3b1"
///
[Required]
public bool EdgeNameAutoGenerate { get; set; } = false;
// ==========================================
// NODE SETTINGS
// ==========================================
///
/// Auto-generate node names when creating new nodes
/// Uses 8-character GUID: "Node_a7f2e3b1"
///
[Required]
public bool NodeNameAutoGenerate { get; set; } = true;
///
/// Node proximity radius (in METERS) for edge creation
/// When creating an edge, if start/end point is within this radius of an existing node,
/// the edge will connect to that existing node instead of creating a new one
/// Default: 0.35 meters (35 cm)
///
[Required]
public double NodeProximityRadius { get; set; } = 0.35;
// ==========================================
// COORDINATE SYSTEM SETTINGS
// ==========================================
///
/// World coordinate origin X in METERS
/// Defines where the world coordinate system (0, 0) is located
/// Default: 0.0
///
[Required]
public double OriginX { get; set; } = 0.0;
///
/// World coordinate origin Y in METERS
/// Defines where the world coordinate system (0, 0) is located
/// Default: 0.0
///
[Required]
public double OriginY { get; set; } = 0.0;
///
/// Resolution: Meters per pixel
/// Conversion factor between world coordinates (meters) and image coordinates (pixels)
/// Example: 0.05 means 1 pixel = 5 cm in real world
/// Default: 0.05 (5 cm per pixel)
///
[Required]
public double Resolution { get; set; } = 0.05;
// ==========================================
// COORDINATE BOUNDS (World Coordinates)
// ==========================================
///
/// Minimum X boundary in METERS (world coordinates)
/// Defines the leftmost valid coordinate for this level
/// Optional: null means no limit
///
public double? BoundsMinX { get; set; }
///
/// Maximum X boundary in METERS (world coordinates)
/// Defines the rightmost valid coordinate for this level
/// Optional: null means no limit
///
public double? BoundsMaxX { get; set; }
///
/// Minimum Y boundary in METERS (world coordinates)
/// Defines the bottom valid coordinate for this level
/// Optional: null means no limit
///
public double? BoundsMinY { get; set; }
///
/// Maximum Y boundary in METERS (world coordinates)
/// Defines the top valid coordinate for this level
/// Optional: null means no limit
///
public double? BoundsMaxY { get; set; }
// ==========================================
// BACKGROUND IMAGE SETTINGS
// ==========================================
///
/// Background image width in PIXELS
/// Represents the actual pixel dimensions of the image file
/// Used for rendering and coordinate conversion
///
public double? ImageWidth { get; set; }
///
/// Background image height in PIXELS
/// Represents the actual pixel dimensions of the image file
/// Used for rendering and coordinate conversion
///
public double? ImageHeight { get; set; }
// ==========================================
// METADATA
// ==========================================
///
/// When these settings were created
///
[Required]
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
///
/// Last time these settings were modified
///
[Required]
public DateTime ModifiedDate { get; set; } = DateTime.UtcNow;
// ==========================================
// NAVIGATION PROPERTIES
// ==========================================
[ForeignKey(nameof(LevelId))]
public virtual LayoutLevel Level { get; set; } = null!;
}