104 lines
2.6 KiB
C#
104 lines
2.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace DataServer.Data.Entities;
|
|
|
|
/// <summary>
|
|
/// Bucket used for tile connectivity and filtering.
|
|
/// </summary>
|
|
[Table("tile_buckets")]
|
|
public class TileBucket
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
|
|
[Required, MaxLength(64)]
|
|
public string Name { get; set; } = "";
|
|
|
|
/// <summary>Optional bucket category/type (e.g., "biome", "floor", "wall")</summary>
|
|
[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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Explicit allow-list rule: Source bucket can connect to Target bucket.
|
|
/// </summary>
|
|
[Table("tile_bucket_rules")]
|
|
public class TileBucketRule
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
|
|
public int SourceBucketId { get; set; }
|
|
|
|
public int TargetBucketId { get; set; }
|
|
|
|
/// <summary>Optional weight for selection bias (1.0 = default)</summary>
|
|
public float Weight { get; set; } = 1.0f;
|
|
|
|
[ForeignKey(nameof(SourceBucketId))]
|
|
public TileBucket? SourceBucket { get; set; }
|
|
|
|
[ForeignKey(nameof(TargetBucketId))]
|
|
public TileBucket? TargetBucket { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Join table: which buckets a tile definition belongs to.
|
|
/// </summary>
|
|
[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; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Saved stamp of multiple tile placements for fast painting.
|
|
/// </summary>
|
|
[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;
|
|
|
|
/// <summary>
|
|
/// JSON array of placements: { x, y, tileDefinitionId, layer }
|
|
/// </summary>
|
|
[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;
|
|
}
|