using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
///
/// One scene within a multi-scene custom room. Most rooms historically
/// had only Scenes[0] (synthesised in BuildRoomDetails from
/// +
/// ); rooms imported from a
/// multi-scene archive write one row per chapter here, and the wire-shape
/// builder emits the full Scenes[] array from this table when any
/// rows exist.
///
/// The scene's on the wire is this table's
/// — the matchmaking SubRoomId the watch
/// passes to /goto/room/{name}/{subroom} matches against
/// , then resolves to for
/// RoomInstance.SubRoomId.
///
public class RoomSceneEntity
{
public long Id { get; set; }
/// FK to . Indexed so the per-room
/// fetch in BuildRoomDetails is one query.
public long RoomId { get; set; }
/// 0-based index this scene occupies in the wire
/// Scenes[] array. Doubles as the RoomSceneId the
/// matchmaking flow uses for RoomInstance.SubRoomId.
public int OrderIndex { get; set; }
/// Display name (e.g. "Lobby", "Ch1_Headfirst"). Matched
/// case-insensitively against the sub-room segment of
/// /goto/room/{name}/{subroom}.
[MaxLength(128)]
public string Name { get; set; } = string.Empty;
/// The RoomSceneLocationId GUID the client uses to
/// look up the bundled stage prefab via
/// AGRoomSettings.TryGetRoomSceneLocationById. Defaults to
/// the MakerRoom (Basement) scene GUID — the canonical "blank
/// canvas" stage 2020 custom rooms were built on. Extracted from
/// resources.assets via tools/extract-locations-binary.py: the
/// "Maker Room" Location entry has SceneName=Basement and
/// ReplicationId=a75f7547-79eb-47c6-8986-6767abcb4f92.
[MaxLength(64)]
public string RoomSceneLocationId { get; set; } = "a75f7547-79eb-47c6-8986-6767abcb4f92";
/// The the watch
/// downloads as the persisted state for this scene.
[MaxLength(128)]
public string DataBlobName { get; set; } = string.Empty;
/// Original RecNet Studio save id for this sub-room, when
/// the scene was imported from a Studio dump. Used by
/// rooms/{roomId}/subrooms/{subRoomId}/saves/{saveId} to return the
/// baked Unity asset bundle filenames the 2023 client downloads.
public long? StudioSubRoomDataSaveId { get; set; }
[MaxLength(64)]
public string StudioUnityAssetId { get; set; } = string.Empty;
[MaxLength(4096)]
public string StudioAssetBundleNamesCsv { get; set; } = string.Empty;
public int MaxPlayers { get; set; } = 8;
public bool IsSandbox { get; set; } = false;
public bool CanMatchmakeInto { get; set; } = true;
public DateTime DataModifiedAt { get; set; } = DateTime.UtcNow;
}