using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace DataServer.Data.Entities; /// /// Bucket used for tile connectivity and filtering. /// [Table("tile_buckets")] public class TileBucket { [Key] public int Id { get; set; } [Required, MaxLength(64)] public string Name { get; set; } = ""; /// Optional bucket category/type (e.g., "biome", "floor", "wall") [MaxLength(32)] public string? BucketType { get; set; } [MaxLength(256)] public string? Description { get; set; } public bool IsEnabled { get; set; } = true; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; } /// /// Explicit allow-list rule: Source bucket can connect to Target bucket. /// [Table("tile_bucket_rules")] public class TileBucketRule { [Key] public int Id { get; set; } public int SourceBucketId { get; set; } public int TargetBucketId { get; set; } /// Optional weight for selection bias (1.0 = default) public float Weight { get; set; } = 1.0f; [ForeignKey(nameof(SourceBucketId))] public TileBucket? SourceBucket { get; set; } [ForeignKey(nameof(TargetBucketId))] public TileBucket? TargetBucket { get; set; } } /// /// Join table: which buckets a tile definition belongs to. /// [Table("tile_definition_buckets")] public class TileDefinitionBucket { [Key] public int Id { get; set; } public int TileDefinitionId { get; set; } public int TileBucketId { get; set; } [ForeignKey(nameof(TileDefinitionId))] public TileDefinition? TileDefinition { get; set; } [ForeignKey(nameof(TileBucketId))] public TileBucket? TileBucket { get; set; } } /// /// Saved stamp of multiple tile placements for fast painting. /// [Table("tile_stamps")] public class TileStamp { [Key] public int Id { get; set; } [Required, MaxLength(64)] public string Name { get; set; } = ""; [MaxLength(256)] public string? Description { get; set; } public int Width { get; set; } = 1; public int Height { get; set; } = 1; /// /// JSON array of placements: { x, y, tileDefinitionId, layer } /// [Column(TypeName = "json")] public string? TilesJson { get; set; } public bool IsEnabled { get; set; } = true; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; }