{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "routine.schema.json", "title": "NPC Routine Schedules", "description": "Daily routine schedules — all NPCs in one file per district for cross-NPC validation (D-034).", "type": "object", "required": ["district", "schedules"], "additionalProperties": false, "properties": { "district": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "District slug this routine file belongs to" }, "schedules": { "type": "array", "items": { "$ref": "#/$defs/npc_schedule" }, "minItems": 1 } }, "$defs": { "npc_schedule": { "type": "object", "required": ["npc", "entries"], "additionalProperties": false, "properties": { "npc": { "type": "string", "pattern": "^npc:[a-z][a-z0-9-]*$", "description": "NPC short-form canonical ID" }, "entries": { "type": "array", "items": { "$ref": "#/$defs/routine_entry" }, "minItems": 1 }, "deviations": { "type": "array", "items": { "$ref": "#/$defs/deviation" }, "description": "Conditional schedule overrides (FRIEND arc staging, etc.)" } } }, "routine_entry": { "type": "object", "required": ["phase", "location"], "additionalProperties": false, "properties": { "phase": { "type": "string", "enum": ["morning", "afternoon", "evening", "night"], "description": "Day phase for this entry" }, "location": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "Location slug" }, "tile": { "type": "object", "properties": { "x": { "type": "integer" }, "y": { "type": "integer" } }, "required": ["x", "y"], "description": "Specific tile coordinates within the location" }, "activity": { "type": "string", "description": "What the NPC is doing at this location/time" } } }, "deviation": { "type": "object", "required": ["trigger", "location"], "additionalProperties": false, "properties": { "trigger": { "type": "string", "description": "Condition that activates this deviation" }, "phase": { "type": "string", "enum": ["morning", "afternoon", "evening", "night"] }, "location": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }, "tile": { "type": "object", "properties": { "x": { "type": "integer" }, "y": { "type": "integer" } }, "required": ["x", "y"] }, "activity": { "type": "string" } } } } }