using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
///
/// Per-thread metadata for chat: name (for group chats), creator, and
/// timestamps. Rows here are sparse — a two-person DM doesn't need
/// one unless the players want a custom thread name. Group chats
/// always have a row so the member set + name are persisted.
///
public class ChatThreadEntity
{
public long Id { get; set; }
/// Canonical thread key (matches ChatMessageEntity.ThreadKey).
/// Format: dm:<low>:<high> for DMs,
/// group:<guid> for group chats, room:<id> for room-wide.
[MaxLength(96)]
public string ThreadKey { get; set; } = string.Empty;
/// Optional custom name. DMs default to empty (watch renders
/// "Chat with <username>" client-side); group chats persist a
/// name set via PUT thread/{id}/rename.
[MaxLength(128)]
public string Name { get; set; } = string.Empty;
public long CreatorPlayerId { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}