{"openapi":"3.0.3","info":{"title":"Incident Tracker API","description":"API for the Incident Tracker","version":"1.0.0"},"components":{"schemas":{}},"paths":{"/ai/{siteId}/rewrite":{"post":{"tags":["AI"],"description":"Rewrite selected report text using OpenAI.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["action","text"],"properties":{"action":{"type":"string"},"text":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"result_text":{"type":"string"}}}}}}}}},"/ai/{siteId}/incident-suggestions":{"post":{"tags":["AI"],"description":"Generate generic incident description suggestions from same-category examples.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["incident_id","category_id"],"properties":{"incident_id":{"type":"string"},"category_id":{"type":"string"},"description":{"type":"string"},"short_description":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"suggestions":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"reason":{"type":"string"}},"required":["text"]}}},"required":["suggestions"]}}}}}}},"/ai/{siteId}/incident-summary":{"post":{"tags":["AI"],"description":"Generate (or force-regenerate) an AI summary for an incident covering what happened, who was involved, and key timings. The result is persisted on the incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["incident_id"],"properties":{"incident_id":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"string"},"generated_at":{"type":"string"}},"required":["summary","generated_at"]}}}}}}},"/asset-categories/{siteId}":{"get":{"tags":["Asset Categories"],"description":"List all asset categories for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Asset Categories"],"description":"Create an asset category.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","class"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"colour":{"type":"string"},"icon":{"type":"string"},"class":{"type":"string","enum":["appliance","mechanical","electrical","consumable","other"]},"minimum_stock_level":{"type":"number"},"low_stock_incident_category":{"type":"string"},"custom_field_definitions":{"type":"array"},"default_field_values":{"type":"object"},"asset_status_pipeline":{"type":"array"},"requires_flushing":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-categories/{siteId}/{categoryId}":{"get":{"tags":["Asset Categories"],"description":"Get a single asset category.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Asset Categories"],"description":"Update an asset category.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"colour":{"type":"string"},"icon":{"type":"string"},"class":{"type":"string","enum":["appliance","mechanical","electrical","consumable","other"]},"minimum_stock_level":{"type":"number"},"low_stock_incident_category":{"type":"string"},"custom_field_definitions":{"type":"array"},"default_field_values":{"type":"object"},"asset_status_pipeline":{"type":"array"},"requires_flushing":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-categories/{siteId}/{categoryId}/archive":{"patch":{"tags":["Asset Categories"],"description":"Archive or unarchive an asset category.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["archived"],"properties":{"archived":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-models/{siteId}":{"get":{"tags":["Asset Models"],"description":"List asset models for a site.","parameters":[{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"archived","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Asset Models"],"description":"Create an asset model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["category","name"],"properties":{"category":{"type":"string"},"name":{"type":"string"},"physical_or_virtual":{"type":"string","enum":["physical","virtual"]},"manufacturer":{"type":"string"},"model_number":{"type":"string"},"supplier":{"type":"string"},"colour":{"type":"string"},"tag_colour":{"type":"string"},"value":{"type":"number"},"custom_field_definitions":{"type":"array"},"default_field_values_for_assets":{"type":"object"},"requires_flushing":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-models/{siteId}/{modelId}":{"get":{"tags":["Asset Models"],"description":"Get a single asset model.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Asset Models"],"description":"Update an asset model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"category":{"type":"string"},"name":{"type":"string"},"physical_or_virtual":{"type":"string","enum":["physical","virtual"]},"manufacturer":{"type":"string"},"model_number":{"type":"string"},"supplier":{"type":"string"},"colour":{"type":"string"},"tag_colour":{"type":"string"},"value":{"type":"number"},"custom_field_definitions":{"type":"array"},"default_field_values_for_assets":{"type":"object"},"requires_flushing":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-models/{siteId}/{modelId}/archive":{"patch":{"tags":["Asset Models"],"description":"Archive or unarchive an asset model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["archived"],"properties":{"archived":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-models/{siteId}/{modelId}/photo-upload-url":{"post":{"tags":["Asset Models"],"description":"Get a presigned URL to upload a photo for an asset model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content_type","file_name"],"properties":{"content_type":{"type":"string"},"file_name":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/asset-models/{siteId}/{modelId}/photo":{"patch":{"tags":["Asset Models"],"description":"Set the photo object key for an asset model after upload.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["photo_object_id"],"properties":{"photo_object_id":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/audit":{"get":{"tags":["Assets"],"description":"Retrieve audit trail for an asset with optional tab-based filtering.","parameters":[{"schema":{"type":"string"},"in":"query","name":"tab","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"number"},"in":"query","name":"page","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-create-from-model":{"post":{"tags":["Assets"],"description":"Bulk create assets from a model (e.g. receive 10 dryers).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model_id","count"],"properties":{"model_id":{"type":"string"},"count":{"type":"number","minimum":1,"maximum":500},"defaults":{"type":"object"},"generate_barcodes":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-status":{"post":{"tags":["Assets"],"description":"Bulk update status on multiple assets.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["asset_ids","status"],"properties":{"asset_ids":{"type":"array","items":{"type":"string"}},"status":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-move":{"post":{"tags":["Assets"],"description":"Bulk move assets to a location.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["asset_ids","location"],"properties":{"asset_ids":{"type":"array","items":{"type":"string"}},"location":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-assign-owner":{"post":{"tags":["Assets"],"description":"Bulk assign owner to assets.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["asset_ids"],"properties":{"asset_ids":{"type":"array","items":{"type":"string"}},"owner_user":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-dispose":{"post":{"tags":["Assets"],"description":"Bulk dispose assets.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["asset_ids","disposal_reason"],"properties":{"asset_ids":{"type":"array","items":{"type":"string"}},"disposal_reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-purge":{"post":{"tags":["Assets"],"description":"Permanently delete multiple assets and every dependent record (relationships, verifications, stock movements). Requires asset:purge permission.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["asset_ids"],"properties":{"asset_ids":{"type":"array","items":{"type":"string"},"maxItems":500}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}":{"get":{"tags":["Assets"],"description":"List assets for a site with optional filters.","parameters":[{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"model","required":false},{"schema":{"type":"string"},"in":"query","name":"location","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"owner_user","required":false},{"schema":{"type":"string"},"in":"query","name":"condition","required":false},{"schema":{"type":"string"},"in":"query","name":"archived","required":false},{"schema":{"type":"string"},"in":"query","name":"disposed","required":false},{"schema":{"type":"number"},"in":"query","name":"page","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Assets"],"description":"Create a new asset.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model"],"properties":{"model":{"type":"string"},"name":{"type":"string"},"serial_number":{"type":"string"},"status":{"type":"string"},"location":{"type":"string"},"owner_user":{"type":"string"},"condition":{"type":"string"},"barcode":{"type":"string"},"scribble_number":{"type":"string"},"commissioned_date":{"type":"string"},"installed_date":{"type":"string"},"warranty_expiry":{"type":"string"},"expected_replacement_date":{"type":"string"},"custom_fields":{"type":"array"},"stock_quantity":{"type":"number"},"stock_unit":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}":{"get":{"tags":["Assets"],"description":"Get a single asset by its MongoDB _id.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Assets"],"description":"Update an asset.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"serial_number":{"type":"string"},"status":{"type":"string"},"location":{"type":"string"},"owner_user":{"type":"string"},"condition":{"type":"string"},"barcode":{"type":"string"},"scribble_number":{"type":"string"},"commissioned_date":{"type":"string"},"installed_date":{"type":"string"},"warranty_expiry":{"type":"string"},"expected_replacement_date":{"type":"string"},"custom_fields":{"type":"array"},"stock_quantity":{"type":"number"},"stock_unit":{"type":"string"},"model":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Assets"],"description":"Archive (soft-delete) an asset.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/purge":{"delete":{"tags":["Assets"],"description":"Permanently delete an asset and all of its dependent records (relationships, verifications, stock movements). Requires asset:purge permission. Audit logs are preserved as they are immutable.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/dashboard":{"get":{"tags":["Assets"],"description":"Asset dashboard: counts by status, category, condition, and low-stock alerts.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/disposal/request":{"post":{"tags":["Assets"],"description":"Request disposal of an asset. Requires asset:dispose permission.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["disposal_reason"],"properties":{"disposal_reason":{"type":"string"},"notes":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/disposal/approve":{"post":{"tags":["Assets"],"description":"Approve a disposal request. Requires asset:approve_disposal permission.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"notes":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/disposal/finalise":{"post":{"tags":["Assets"],"description":"Finalise disposal and mark the asset as disposed. Requires asset:dispose permission.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/export":{"get":{"tags":["Assets"],"description":"Export assets as a multi-sheet XLSX workbook.","parameters":[{"schema":{"type":"string"},"in":"query","name":"archived","required":false},{"schema":{"type":"string"},"in":"query","name":"disposed","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/import/preview":{"post":{"tags":["Assets"],"description":"Preview a CSV/XLSX import: resolves models, categories, locations without writing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","rows"],"properties":{"site":{"type":"string"},"rows":{"type":"array","items":{"type":"object","required":["row_index","values"],"properties":{"row_index":{"type":"number"},"values":{"type":"object","properties":{"name":{"type":"string"},"model":{"type":"string"},"category":{"type":"string"},"serial_number":{"type":"string"},"barcode":{"type":"string"},"scribble_number":{"type":"string"},"status":{"type":"string"},"condition":{"type":"string"},"location":{"type":"string"},"owner":{"type":"string"},"commissioned_date":{"type":"string"},"installed_date":{"type":"string"},"warranty_expiry":{"type":"string"},"expected_replacement_date":{"type":"string"},"stock_quantity":{"type":"string"},"stock_unit":{"type":"string"}},"additionalProperties":true}}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/import/commit":{"post":{"tags":["Assets"],"description":"Commit a previewed asset import.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","rows","idempotency_key"],"properties":{"site":{"type":"string"},"idempotency_key":{"type":"string"},"rows":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/relationships":{"get":{"tags":["Assets"],"description":"List relationships for an asset in both directions.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/relationships":{"post":{"tags":["Assets"],"description":"Create an asset relationship.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","source_asset","target_asset"],"properties":{"type":{"type":"string","enum":["contains","installed_in","powered_by","connected_to","replaced_by","part_of","spare_for"]},"source_asset":{"type":"string"},"target_asset":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/relationships/{relationshipId}":{"delete":{"tags":["Assets"],"description":"Delete an asset relationship.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"relationshipId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/scan":{"get":{"tags":["Assets"],"description":"Resolve a scanned code to an asset.","parameters":[{"schema":{"type":"string"},"in":"query","name":"code","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/search":{"get":{"tags":["Assets"],"description":"Search assets using Typesense with faceted filtering. Use `location` (or `location_ancestor`) to filter to assets in or beneath a given location id; `q` matches against name, identifiers and the full location breadcrumb (including parent location names).","parameters":[{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"number"},"in":"query","name":"page","required":false},{"schema":{"type":"number"},"in":"query","name":"per_page","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"filter_by","required":false},{"schema":{"type":"string"},"in":"query","name":"sort_by","required":false},{"schema":{"type":"string"},"in":"query","name":"facet_by","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"model","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"condition","required":false},{"schema":{"type":"string"},"in":"query","name":"archived","required":false},{"schema":{"type":"string"},"in":"query","name":"disposed","required":false},{"schema":{"type":"string"},"in":"query","name":"location","required":false},{"schema":{"type":"string"},"in":"query","name":"location_ancestor","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/verify":{"post":{"tags":["Assets"],"description":"Mark an asset as verified at an optional location.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"location":{"type":"string"},"source":{"type":"string","enum":["manual","scan","bulk"]},"notes":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/bulk-verify":{"post":{"tags":["Assets"],"description":"Bulk verify multiple assets.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["asset_ids"],"properties":{"asset_ids":{"type":"array","items":{"type":"string"}},"location":{"type":"string"},"notes":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/assets/{siteId}/{assetId}/verifications":{"get":{"tags":["Assets"],"description":"List verification history for an asset.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"assetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/block-bookings/{blockId}":{"get":{"tags":["BlockBookings"],"description":"Retrieve a block booking with its member bookings (populated like the bookings list).","parameters":[{"schema":{"type":"string"},"in":"query","name":"site","required":true},{"schema":{"type":"string"},"in":"path","name":"blockId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["BlockBookings"],"description":"Edit a block booking's name or notes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site"],"properties":{"site":{"type":"string"},"name":{"type":"string","minLength":1},"notes":{"type":["string","null"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"blockId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["BlockBookings"],"description":"Archive a block booking (soft delete). Member bookings keep their block_booking ref so historical grouping is preserved.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site"],"properties":{"site":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"blockId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/block-bookings/{blockId}/transitions":{"post":{"tags":["BlockBookings"],"description":"Apply the same transition to every member booking of the block. Returns per-member success/failure so the caller can show a partial-success summary.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","type"],"properties":{"site":{"type":"string"},"type":{"type":"string","enum":["check_in","check_out","move_in","move_out","arrival","no_show","void","status_change"]},"occurred_at":{"type":"string"},"notes":{"type":"string"},"cancellation_code":{"type":"string"},"cancellation_reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"blockId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/bookings/bulk":{"post":{"tags":["Bookings"],"description":"Create many bookings at once, optionally tied together as a block booking. Supports per-row override (void/checkout an existing live booking on the same room).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","contract_start","assignments"],"properties":{"site":{"type":"string"},"contract_start":{"type":"string"},"contract_end":{"type":"string"},"flags":{"type":"array","items":{"type":"string"}},"notes":{"type":"string"},"block":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1},"notes":{"type":"string"}}},"assignments":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"object","required":["person_id","location_id"],"properties":{"person_id":{"type":"string"},"location_id":{"type":"string"},"additional_people":{"type":"array","items":{"type":"string"}},"override":{"type":"object","required":["conflict_booking_id","action"],"properties":{"conflict_booking_id":{"type":"string"},"action":{"type":"string","enum":["void","checkout"]},"cancellation_code":{"type":"string"}}}}}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/bookings":{"get":{"tags":["Bookings"],"description":"List bookings for a site.","parameters":[{"schema":{"type":"string"},"in":"query","name":"site","required":true},{"schema":{"type":"string"},"in":"query","name":"person","required":false},{"schema":{"type":"string"},"in":"query","name":"location","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"block_booking","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"string"},"in":"query","name":"include","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"number"},"in":"query","name":"skip","required":false},{"schema":{"type":"string","enum":["location","last_name","first_name","contract_end","contract_start"]},"in":"query","name":"sort","required":false}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Bookings"],"description":"Create a booking.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","lead_person","location"],"properties":{"site":{"type":"string"},"lead_person":{"type":"string"},"additional_people":{"type":"array","items":{"type":"string"}},"location":{"type":"string"},"status":{"type":"string","enum":["checked_in","arrived","not_arrived","checked_out","void"]},"contract_start":{"type":"string"},"contract_end":{"type":"string"},"vehicle_registration":{"type":"string"},"parking_expiry_at":{"type":"string"},"departure_slot_at":{"type":"string"},"flags":{"type":"array","items":{"type":"string"}},"notes":{"type":"string"},"block_booking":{"type":"string"},"override":{"type":"object","required":["conflict_booking_id","action"],"properties":{"conflict_booking_id":{"type":"string"},"action":{"type":"string","enum":["void","checkout"]},"cancellation_code":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/bookings/{bookingId}":{"get":{"tags":["Bookings"],"description":"Retrieve a single booking.","parameters":[{"schema":{"type":"string"},"in":"query","name":"site","required":true},{"schema":{"type":"string"},"in":"query","name":"include","required":false},{"schema":{"type":"string"},"in":"path","name":"bookingId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Bookings"],"description":"Update a booking (metadata only — use /transitions to change status).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site"],"properties":{"site":{"type":"string"},"lead_person":{"type":"string"},"additional_people":{"type":"array","items":{"type":"string"}},"location":{"type":"string"},"contract_start":{"type":["string","null"]},"contract_end":{"type":["string","null"]},"vehicle_registration":{"type":["string","null"]},"parking_expiry_at":{"type":["string","null"]},"departure_slot_at":{"type":["string","null"]},"flags":{"type":"array","items":{"type":"string"}},"notes":{"type":["string","null"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"bookingId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/bookings/export":{"get":{"tags":["Bookings"],"description":"Export bookings as CSV.","parameters":[{"schema":{"type":"string"},"in":"query","name":"site","required":true},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["first_name","last_name","location","contract_start","contract_end"]},"in":"query","name":"sort_by","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/bookings/import/preview":{"post":{"tags":["Bookings"],"description":"Preview a CSV import: resolves people, locations, status inference and conflicts without writing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","rows"],"properties":{"site":{"type":"string"},"rows":{"type":"array","items":{"type":"object","required":["row_index","values"],"properties":{"row_index":{"type":"number"},"values":{"type":"object","properties":{"student_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"room":{"type":"string"},"contract_start":{"type":"string"},"contract_end":{"type":"string"},"vehicle_registration":{"type":"string"},"parking_expiry":{"type":"string"},"departure_slot":{"type":"string"},"notes":{"type":"string"}},"additionalProperties":true}}}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/bookings/import/commit":{"post":{"tags":["Bookings"],"description":"Commit a previously-previewed CSV import with user decisions applied.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","rows","idempotency_key","resolutions"],"properties":{"site":{"type":"string"},"idempotency_key":{"type":"string"},"rows":{"type":"array","items":{"type":"object","required":["row_index","values"],"properties":{"row_index":{"type":"number"},"values":{"type":"object","properties":{"student_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"room":{"type":"string"},"contract_start":{"type":"string"},"contract_end":{"type":"string"},"vehicle_registration":{"type":"string"},"parking_expiry":{"type":"string"},"departure_slot":{"type":"string"},"notes":{"type":"string"}},"additionalProperties":true}}}},"resolutions":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/bookings/{bookingId}/transitions":{"post":{"tags":["Bookings"],"description":"Record a state transition / transaction on a booking.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","type"],"properties":{"site":{"type":"string"},"type":{"type":"string","enum":["check_in","check_out","move_in","move_out","arrival","no_show","void","status_change"]},"occurred_at":{"type":"string"},"notes":{"type":"string"},"cancellation_code":{"type":"string"},"cancellation_reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"bookingId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/bookings/{bookingId}/transactions":{"get":{"tags":["Bookings"],"description":"List all transactions for a booking.","parameters":[{"schema":{"type":"string"},"in":"query","name":"site","required":true},{"schema":{"type":"string"},"in":"path","name":"bookingId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/developer/apps":{"get":{"tags":["Developer"],"description":"List the current user's developer applications.","responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Developer"],"description":"Create a developer application and return its API key.","responses":{"200":{"description":"Default Response"}}}},"/developer/apps/{appId}":{"patch":{"tags":["Developer"],"description":"Rename a developer application.","parameters":[{"schema":{"type":"string"},"in":"path","name":"appId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Developer"],"description":"Delete a developer application.","parameters":[{"schema":{"type":"string"},"in":"path","name":"appId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/developer/apps/{appId}/authorise":{"put":{"tags":["Developer"],"description":"Authorise a developer application for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"appId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/developer/apps/{siteId}/authorised":{"get":{"tags":["Developer"],"description":"List developer applications authorised for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/assets":{"get":{"tags":["Incidents"],"description":"List assets tagged to an incident.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}},"put":{"tags":["Incidents"],"description":"Tag assets to an incident and set asset action context.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tagged_assets"],"properties":{"tagged_assets":{"type":"array","items":{"type":"string"}},"asset_action_context":{"type":"object","properties":{"destination_location":{"type":"string"},"disposal_reason":{"type":"string"},"resulting_asset_status":{"type":"string"}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/execute-asset-action":{"post":{"tags":["Incidents"],"description":"Execute the configured asset action for an incident (triggered by status transitions).","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/attachments":{"post":{"tags":["Incidents"],"description":"Generate a presigned URL for an attachment to an incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content_type","file_name"],"properties":{"content_type":{"type":"string"},"file_name":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"object_id":{"type":"string"}},"required":["url","object_id"]}}}}}},"put":{"tags":["Incidents"],"description":"Add an attachment to an incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["object_id","content_type","file_name"],"properties":{"object_id":{"type":"string"},"content_type":{"type":"string"},"file_name":{"type":"string"},"description":{"type":"string"},"evidence_type":{"type":"string"},"retention_label":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"raw_url":{"type":"string"},"source_uri":{"type":"string"},"file_type":{"type":"string"},"uploaded":{"type":"boolean"},"object_id":{"type":"string"}},"required":["name","raw_url","source_uri","file_type","uploaded","object_id"]}}}}}},"delete":{"tags":["Incidents"],"description":"Delete an attachment from an incident.","parameters":[{"schema":{"type":"string"},"in":"query","name":"objectId","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/incidents/{siteId}/{incidentId}/attachments/download":{"get":{"tags":["Incidents"],"description":"Get a download URL for an attachment (audit-logged).","parameters":[{"schema":{"type":"string"},"in":"query","name":"objectId","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/attachments/proxy":{"get":{"tags":["Incidents"],"description":"Stream a cold-storage attachment back through the API so the raw signed Spaces URL never reaches the browser.","parameters":[{"schema":{"type":"string"},"in":"query","name":"objectId","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/attachments/download-all":{"get":{"tags":["Incidents"],"description":"Download all attachments for an incident as a single ZIP archive (audit-logged).","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/attachments/migrate":{"post":{"tags":["Incidents"],"description":"Enqueue a single attachment for immediate migration to cold storage.","parameters":[{"schema":{"type":"string"},"in":"query","name":"objectId","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string"}},"required":["job_id"]}}}}}}},"/incidents/{siteId}/{incidentId}/audit":{"get":{"tags":["Audit"],"description":"Retrieve audit trail for an incident.","parameters":[{"schema":{"type":"number"},"in":"query","name":"page","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"operation","required":false},{"schema":{"type":"string"},"in":"query","name":"actor","required":false},{"schema":{"type":"string"},"in":"query","name":"start_date","required":false},{"schema":{"type":"string"},"in":"query","name":"end_date","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}},"put":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/bulk/status":{"post":{"tags":["Incidents"],"description":"Bulk-change the status of multiple incidents. Requires incident:bulk_action and incident:edit permissions. Closing transitions also require incident:close.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["incident_ids","status"],"properties":{"incident_ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":200},"status":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"updated":{"type":"number"},"skipped":{"type":"array","items":{"type":"object","properties":{"incident_id":{"type":"string"},"reason":{"type":"string"}}}}}}}}}}}},"/incidents/{siteId}/bulk/delete":{"post":{"tags":["Incidents"],"description":"Bulk-delete multiple incidents. Requires incident:bulk_action and incident:delete permissions.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["incident_ids"],"properties":{"incident_ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":200}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"number"},"skipped":{"type":"array","items":{"type":"object","properties":{"incident_id":{"type":"string"},"reason":{"type":"string"}}}}}}}}}}}},"/incidents/{siteId}/{incidentId}/comments":{"post":{"tags":["Incidents"],"description":"Create a new comment on an incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"incident":{"type":"string"},"message":{"type":"string"},"author":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","incident","message","author","created_at","updated_at"]}}}}}}},"/incidents/{siteId}/{incidentId}/comments/{commentId}":{"delete":{"tags":["Incidents"],"description":"Delete a comment on an incident.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"commentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/incidents":{"post":{"tags":["Incidents"],"description":"Create a new incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","category","source"],"properties":{"site":{"type":"string"},"category":{"type":"string"},"source":{"type":"string"},"people_involved":{"type":"array","items":{"type":"string"}},"short_description":{"type":"string"},"retrospective_raised_at":{"type":"string"},"parent_incident":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"urn":{"type":"number"},"site":{"type":"string"},"category":{"type":"string"},"source":{"type":"string"},"people_involved":{"type":"array","items":{"type":"string"}},"priority":{"type":"string"},"raised_by":{"type":"string"},"status":{"type":"string"},"staff":{"type":"array","items":{"type":"string"}},"attachments":{"type":"array","items":{"type":"string"}},"short_description":{"type":"string"},"parent_incident":{"type":"string"}},"required":["_id","urn","site","category","source","priority","raised_by","status","staff","attachments","short_description"]}}}}}}},"/incidents/{siteId}/upload":{"post":{"tags":["Incidents"],"description":"Create a new from a report from UNN.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"urn":{"type":"number"},"site":{"type":"string"},"category":{"type":"string"},"source":{"type":"string"},"people_involved":{"type":"array","items":{"type":"string"}},"priority":{"type":"string"},"raised_by":{"type":"string"},"status":{"type":"string"},"staff":{"type":"array","items":{"type":"string"}},"attachments":{"type":"array","items":{"type":"string"}},"short_description":{"type":"string"}},"required":["_id","urn","site","category","source","priority","raised_by","status","staff","attachments","short_description"]}}}}}}},"/incidents/{siteId}/dashboard":{"get":{"tags":["Incidents"],"description":"Get analytics data for the dashboard.","parameters":[{"schema":{"type":"string"},"in":"query","name":"startDate","required":true},{"schema":{"type":"string"},"in":"query","name":"endDate","required":false},{"schema":{"type":"string"},"in":"query","name":"categoryId","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"incidents":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"created_at":{"type":"string"},"category":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"}}},"priority":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"}}},"raised_by":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"}}},"people_involved":{"type":"array","items":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"}}}},"status":{"type":"string"},"updated_at":{"type":"string"}}}},"totalCount":{"type":"number"}}}}}}}}},"/incidents/{siteId}/export-csv":{"get":{"tags":["Incidents"],"description":"Export incidents matching the current search/filters as a CSV file.","parameters":[{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"student","required":false},{"schema":{"type":"string"},"in":"query","name":"startDate","required":false},{"schema":{"type":"string"},"in":"query","name":"endDate","required":false},{"schema":{"type":"string"},"in":"query","name":"sortBy","required":false},{"schema":{"type":"string"},"in":"query","name":"assignedTo","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing":{"get":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/import/preview":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/import/confirm":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/start":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/complete":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}":{"delete":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/occupied":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/guest-incident-prefill":{"get":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/guest-incident":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/skip":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/assets/start":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/assets/complete":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/assets/bulk-start":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/{flushLocationId}/assets/bulk-complete":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"flushLocationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/locations/bulk-paper-complete":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/assets/{taskAssetId}/cancel":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"taskAssetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/assets/{taskAssetId}/restart":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"taskAssetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/assets/{taskAssetId}/mark-unflushable":{"post":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"taskAssetId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true},{"schema":{"type":"string"},"in":"path","name":"taskAssetId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/flushing/report":{"get":{"tags":["Flushing"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/governance":{"get":{"tags":["Governance"],"description":"Get governance dashboard data for assurance reporting.","parameters":[{"schema":{"type":"string"},"in":"query","name":"start_date","required":true},{"schema":{"type":"string"},"in":"query","name":"end_date","required":false},{"schema":{"type":"number"},"in":"query","name":"period_days","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/governance/export":{"get":{"tags":["Governance"],"description":"Export governance pack as PDF.","parameters":[{"schema":{"type":"string"},"in":"query","name":"start_date","required":true},{"schema":{"type":"string"},"in":"query","name":"end_date","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/handover/drafts":{"get":{"tags":["Handover Drafts"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Handover Drafts"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/handover/drafts/{draftId}":{"get":{"tags":["Handover Drafts"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"responses":{"200":{"description":"Default Response"}}},"put":{"tags":["Handover Drafts"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Handover Drafts"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/handover":{"get":{"tags":["Incidents"],"description":"Stream a handover email via SSE, with AI bucketing (last N hours, default 12).","parameters":[{"schema":{"type":"number"},"in":"query","name":"hours","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/inventory":{"post":{"tags":["Incidents"],"description":"Prepare inventory for an incident","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}":{"get":{"tags":["Incidents"],"description":"Retrieve a list of incidents for a site.","parameters":[{"schema":{"type":"number"},"in":"query","name":"page","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"sortBy","required":false},{"schema":{"type":"string"},"in":"query","name":"assignedTo","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"header","name":"X-Socket-Id","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"urn":{"type":"number"},"status":{"type":"string"},"category":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"priority":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"assigned_to":{"type":"object"},"short_description":{"type":"string"},"people_involved":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"location":{"type":"string"},"last_name":{"type":"string"},"student_id":{"type":"string"}},"required":["_id","first_name","last_name"]}},"staff":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name"]}},"raised_by":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]},"source":{"type":"object","properties":{"name":{"type":"string"},"_id":{"type":"string"},"colour":{"type":"string"}},"required":["name","_id","colour"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"retrospective_raised_at":{"type":"string"},"repeating_report":{"type":"string"},"repeating_report_occurrence_at":{"type":"string"}},"required":["_id","urn","status","category","priority","short_description","people_involved","staff","raised_by","created_at","updated_at","source","retrospective_raised_at"]}}}}}}}},"/incidents/{siteId}/repeating":{"get":{"tags":["Incidents"],"description":"Retrieve repeating report definitions for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Incidents"],"description":"Create a repeating report definition.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["category","source","short_description","interval_count","interval_unit","incident_date"],"properties":{"category":{"type":"string"},"source":{"type":"string"},"people_involved":{"type":"array","items":{"type":"string"}},"short_description":{"type":"string"},"interval_count":{"type":"number"},"interval_unit":{"type":"string"},"days_of_week":{"type":"array","items":{"type":"integer","minimum":0,"maximum":6},"maxItems":7},"incident_date":{"type":"string"},"end_date":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/repeating/{repeatingReportId}":{"get":{"tags":["Incidents"],"description":"Retrieve a repeating report definition.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"repeatingReportId","required":true}],"responses":{"200":{"description":"Default Response"}}},"put":{"tags":["Incidents"],"description":"Update a repeating report definition.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["category","source","short_description","interval_count","interval_unit","incident_date"],"properties":{"category":{"type":"string"},"source":{"type":"string"},"people_involved":{"type":"array","items":{"type":"string"}},"short_description":{"type":"string"},"interval_count":{"type":"number"},"interval_unit":{"type":"string"},"days_of_week":{"type":"array","items":{"type":"integer","minimum":0,"maximum":6},"maxItems":7},"incident_date":{"type":"string"},"end_date":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"repeatingReportId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Incidents"],"description":"Delete a repeating report definition.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"repeatingReportId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}":{"get":{"tags":["Incidents"],"description":"Retrieve a single incident.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"urn":{"type":"number"},"status":{"type":"string"},"category":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"},"flushing":{"type":"object","nullable":true,"properties":{"enabled":{"type":"boolean"}}},"asset_action":{"type":"object","additionalProperties":true,"nullable":true}},"required":["name","colour","_id"]},"priority":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"assigned_to":{"type":"array"},"short_description":{"type":"string"},"description":{"type":"string"},"people_involved":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"type":{"type":"string"},"student_id":{"type":"string"},"photo_url":{"type":"string"},"record_name":{"type":"string"},"email":{"type":"string"},"section":{"type":"object","properties":{"name":{"type":"string"},"_id":{"type":"string"}},"required":["name","_id"]},"location":{"type":"string"},"active_booking_location_name":{"type":"string"},"active_booking_location_crumb":{"type":"array","items":{"type":"string"}},"active_booking":{"type":"object","properties":{"_id":{"type":"string"},"status":{"type":"string"},"notes":{"type":"string"}}},"welfare_flag":{"type":"boolean"},"flags":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"}}}},"welfare_state":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"}}}},"required":["_id","first_name","last_name","type","record_name"]}},"staff":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"},"type":{"type":"string"},"record_name":{"type":"string"},"job_title":{"type":"string"}},"required":["_id","first_name","last_name","photo_url","type","record_name"]}},"raised_by":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"retrospective_raised_at":{"type":"string"},"comments":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"incident":{"type":"string"},"message":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"author":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]}}}},"timeline_events":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"item_type":{"type":"string"},"operation":{"type":"string"},"summary":{"type":"string"},"created_at":{"type":"string"},"actor":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]}},"required":["_id","item_type","operation","summary","created_at","actor"]}},"attachments":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"file_type":{"type":"string"},"raw_url":{"type":"string"},"source_uri":{"type":"string"},"uploaded":{"type":"boolean"},"object_id":{"type":"string"}},"required":["name","file_type","raw_url","source_uri","uploaded","object_id"]}},"debug_attachments":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"file_type":{"type":"string"},"raw_url":{"type":"string"},"source_uri":{"type":"string"},"uploaded":{"type":"boolean"},"object_id":{"type":"string"}},"required":["name","file_type","raw_url","source_uri","uploaded","object_id"]}},"source":{"type":"object","properties":{"name":{"type":"string"},"_id":{"type":"string"},"colour":{"type":"string"}},"required":["name","_id","colour"]},"custom_fields":{"type":"array","items":{"type":"object","properties":{"form_id":{"type":"string"},"field_id":{"type":"string"},"value":{"type":"string"}}}},"chargeable":{"type":"boolean"},"incident_tracker_sync_status":{"type":"string"},"incident_tracker_reference":{"type":"string"},"report_contains_welfare_flag":{"type":"boolean"},"inventory_status":{"type":"string"},"sla_first_response_at":{"type":"string"},"sla_resolved_at":{"type":"string"},"parent_incident":{"type":"object","nullable":true,"properties":{"_id":{"type":"string"},"urn":{"type":"number"},"status":{"type":"string"},"short_description":{"type":"string"},"created_at":{"type":"string"},"retrospective_raised_at":{"type":"string"}},"required":["_id","urn","status","short_description","created_at"]},"child_incidents":{"type":"array","items":{"type":"object","nullable":true,"properties":{"_id":{"type":"string"},"urn":{"type":"number"},"status":{"type":"string"},"short_description":{"type":"string"},"created_at":{"type":"string"},"retrospective_raised_at":{"type":"string"}},"required":["_id","urn","status","short_description","created_at"]}},"ai_summary":{"type":"string"},"ai_summary_generated_at":{"type":"string"},"ai_summary_pending":{"type":"boolean"}},"required":["_id","urn","status","category","short_description","people_involved","staff","created_at","updated_at","comments","attachments","source","chargeable","report_contains_welfare_flag"]}}}}}},"delete":{"tags":["Incidents"],"description":"Delete a single incident.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}},"put":{"tags":["Incidents"],"description":"Update an incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["attachments","category","people_involved","priority","source","short_description","staff","status"],"properties":{"assigned_to":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"people_involved":{"type":"array","items":{"type":"string"}},"priority":{"type":"string"},"source":{"type":"string"},"short_description":{"type":"string"},"staff":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"retrospective_raised_at":{"type":"string"},"custom_fields":{"type":"array","items":{"type":"object","properties":{"form_id":{"type":"string"},"field_id":{"type":"string"},"value":{"type":"string"}}}},"tagged_assets":{"type":"array","items":{"type":"string"}},"asset_action_context":{"type":"object","properties":{"destination_location":{"type":"string"},"disposal_reason":{"type":"string"},"resulting_asset_status":{"type":"string"}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"asset_action":{"type":"object","properties":{"executed":{"type":"boolean"},"actioned":{"type":"number"},"message":{"type":"string"}}}}}}}}}}},"/incidents/{siteId}/{incidentId}/export":{"get":{"tags":["Incidents"],"description":"Export a single incident as a PDF.","parameters":[{"schema":{"type":"boolean"},"in":"query","name":"withAttachments","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/search":{"get":{"tags":["Incidents"],"description":"Retrieve a list of incidents for a site.","parameters":[{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"student","required":false},{"schema":{"type":"number"},"in":"query","name":"page","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"startDate","required":false},{"schema":{"type":"string"},"in":"query","name":"endDate","required":false},{"schema":{"type":"string"},"in":"query","name":"sortBy","required":false},{"schema":{"type":"string"},"in":"query","name":"assignedTo","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"header","name":"x-socket-id","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"urn":{"type":"number"},"status":{"type":"string"},"category":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"priority":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"source":{"type":"object","properties":{"name":{"type":"string"},"_id":{"type":"string"},"colour":{"type":"string"}},"required":["name","_id","colour"]},"assigned_to":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}},"required":["_id","first_name","last_name"]},"short_description":{"type":"string"},"people_involved":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"location":{"type":"string"},"last_name":{"type":"string"},"student_id":{"type":"string"}},"required":["_id","first_name","last_name"]}},"staff":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name"]}},"raised_by":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"retrospective_raised_at":{"type":"string"},"attachments_length":{"type":"number"},"user_comments_count":{"type":"number"},"sla_first_response_at":{"type":"string"},"sla_resolved_at":{"type":"string"},"repeating_report":{"type":"string"},"repeating_report_occurrence_at":{"type":"string"}},"required":["_id","urn","status","category","priority","source","short_description","people_involved","staff","raised_by","created_at","updated_at","retrospective_raised_at","attachments_length","user_comments_count"]}}}}}}}},"/incidents/{siteId}/stale":{"get":{"tags":["Incidents"],"description":"Retrieve stale incidents for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"header","name":"x-socket-id","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"urn":{"type":"number"},"status":{"type":"string"},"category":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"priority":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"_id":{"type":"string"}},"required":["name","colour","_id"]},"source":{"type":"object","properties":{"name":{"type":"string"},"_id":{"type":"string"},"colour":{"type":"string"}},"required":["name","_id","colour"]},"assigned_to":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}},"required":["_id","first_name","last_name"]},"short_description":{"type":"string"},"people_involved":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"location":{"type":"string"},"last_name":{"type":"string"},"student_id":{"type":"string"}},"required":["_id","first_name","last_name"]}},"staff":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name"]}},"raised_by":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","first_name","last_name","photo_url"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"retrospective_raised_at":{"type":"string"},"attachments_length":{"type":"number"},"user_comments_count":{"type":"number"},"sla_first_response_at":{"type":"string"},"sla_resolved_at":{"type":"string"},"repeating_report":{"type":"string"},"repeating_report_occurrence_at":{"type":"string"}},"required":["_id","urn","status","category","priority","source","short_description","people_involved","staff","raised_by","created_at","updated_at","retrospective_raised_at","attachments_length","user_comments_count"]}}}}}}}},"/incidents/reindex":{"get":{"tags":["Incidents"],"description":"Reindex all incidents in Typesense (admin only).","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}}}}},"/incidents/{siteId}/{incidentId}/sync":{"post":{"tags":["Incidents"],"description":"Sync an incident to the incident tracker","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/incidents/{siteId}/{incidentId}/assign":{"patch":{"tags":["Incidents"],"description":"Assign or unassign an incident.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"assigned_to":{"type":["string","null"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"incidentId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"assigned_to":{"nullable":true,"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"}}}}}}}}}}},"/location-type-asset-rules/{siteId}":{"get":{"tags":["Location Type Asset Rules"],"description":"List asset rules for all location types in a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/location-type-asset-rules/{siteId}/{locationTypeId}":{"get":{"tags":["Location Type Asset Rules"],"description":"Get expected asset rules for a location type.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationTypeId","required":true}],"responses":{"200":{"description":"Default Response"}}},"put":{"tags":["Location Type Asset Rules"],"description":"Upsert expected asset rules for a location type.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["expected"],"properties":{"expected":{"type":"array","items":{"type":"object","required":["quantity"],"properties":{"_id":{"type":"string"},"category":{"type":"string"},"model":{"type":"string"},"quantity":{"type":"number"},"notes":{"type":"string"}}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationTypeId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/location-type-asset-rules/{siteId}/{locationTypeId}/bulk-create-preview":{"get":{"tags":["Location Type Asset Rules"],"description":"Preview how many locations of this type would receive a new asset if the rule were bulk-applied.","parameters":[{"schema":{"type":"string"},"in":"query","name":"rule_id","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationTypeId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/location-type-asset-rules/{siteId}/{locationTypeId}/bulk-create":{"post":{"tags":["Location Type Asset Rules"],"description":"Bulk-create assets for every location of this type that doesn't yet have an asset linked to the given rule.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["rule_id"],"properties":{"rule_id":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationTypeId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/{locationId}/assets":{"get":{"tags":["Locations"],"description":"Get asset summary for a location: expected, actual, missing, extra, verified.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/{locationId}/asset-overrides":{"post":{"tags":["Locations"],"description":"Add a manual asset override for a location.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["manual_remove","manual_add"]},"category":{"type":"string"},"model":{"type":"string"},"quantity":{"type":"number"},"notes":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/availability":{"get":{"tags":["Locations"],"description":"List rooms available for booking in a date range. Supports filtering by housekeeping status (clean/dirty/check/out_of_service), location type, and an ancestor scope. Out-of-order rooms are never returned.","parameters":[{"schema":{"type":"string"},"in":"query","name":"start","required":true},{"schema":{"type":"string"},"in":"query","name":"end","required":false},{"schema":{"type":"boolean"},"in":"query","name":"include_occupied","required":false},{"schema":{"type":"string"},"in":"query","name":"types","required":false},{"schema":{"type":"string"},"in":"query","name":"statuses","required":false},{"schema":{"type":"string"},"in":"query","name":"under","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/availability/cluster":{"get":{"tags":["Locations"],"description":"Find the tightest cluster of N available rooms — the deepest ancestor with at least N available descendants.","parameters":[{"schema":{"type":"string"},"in":"query","name":"start","required":true},{"schema":{"type":"string"},"in":"query","name":"end","required":false},{"schema":{"type":"number","minimum":1},"in":"query","name":"count","required":true},{"schema":{"type":"boolean"},"in":"query","name":"include_occupied","required":false},{"schema":{"type":"string"},"in":"query","name":"types","required":false},{"schema":{"type":"string"},"in":"query","name":"statuses","required":false},{"schema":{"type":"string"},"in":"query","name":"under","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/tree":{"get":{"tags":["Locations"],"description":"Hierarchical location tree for a site. When date filters are provided, each node is annotated with `available_under` and `total_under` counts so callers can show which branches contain availability.","parameters":[{"schema":{"type":"string"},"in":"query","name":"start","required":false},{"schema":{"type":"string"},"in":"query","name":"end","required":false},{"schema":{"type":"boolean"},"in":"query","name":"include_occupied","required":false},{"schema":{"type":"string"},"in":"query","name":"types","required":false},{"schema":{"type":"string"},"in":"query","name":"statuses","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}":{"get":{"tags":["Locations"],"description":"Get all locations for a site (nested children)","parameters":[{"schema":{"type":"boolean"},"in":"query","name":"with_occupants","required":false},{"schema":{"type":"boolean"},"in":"query","name":"with_type","required":false},{"schema":{"type":"boolean"},"in":"query","name":"with_children","required":false},{"schema":{"type":"boolean"},"in":"query","name":"with_active_bookings","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Locations"],"description":"Create a new location","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"parent_code":{"type":"string"},"parent_id":{"type":"string","nullable":true},"erp_code":{"type":"string"},"description":{"type":"string"},"out_of_order_reason":{"type":"string","nullable":true},"out_of_order_remarks":{"type":"string","nullable":true},"through_date":{"type":"string","nullable":true},"return_as":{"type":"string","nullable":true}},"required":["name","code","type","status"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/bookable":{"get":{"tags":["Locations"],"description":"List bookable locations (those whose type has can_be_allocated_to_bookings=true).","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/{locationId}":{"patch":{"tags":["Locations"],"description":"Update a location","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"parent_code":{"type":"string"},"parent_id":{"type":"string","nullable":true},"erp_code":{"type":"string"},"description":{"type":"string"},"out_of_order_reason":{"type":"string","nullable":true},"out_of_order_remarks":{"type":"string","nullable":true},"through_date":{"type":"string","nullable":true},"return_as":{"type":"string","nullable":true}},"required":["name","code","type"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Locations"],"description":"Delete a location","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/bulk-status":{"post":{"tags":["Locations"],"description":"Apply a status (and optional OOO reason/remarks/through/return) to multiple locations at once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["location_ids","status"],"properties":{"location_ids":{"type":"array","minItems":1,"items":{"type":"string"}},"status":{"type":"string"},"out_of_order_reason":{"type":"string","nullable":true},"out_of_order_remarks":{"type":"string","nullable":true},"through_date":{"type":"string","nullable":true},"return_as":{"type":"string","nullable":true}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/bulk":{"delete":{"tags":["Locations"],"description":"Delete multiple locations. Skips any that have children or active bookings.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["location_ids"],"properties":{"location_ids":{"type":"array","minItems":1,"items":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/export-csv":{"get":{"tags":["Locations"],"description":"Export all locations for a site as CSV using the same columns as import (type is location type id).","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{site}/import":{"post":{"tags":["Locations"],"description":"Import a list of locations.","parameters":[{"schema":{"type":"string"},"in":"path","name":"site","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/locations/{siteId}/out-of-order-events":{"get":{"tags":["Locations"],"description":"List Out of Order / Out of Service events for a site, filtered by date.","parameters":[{"schema":{"type":"string"},"in":"query","name":"for_date","required":false},{"schema":{"type":"string"},"in":"query","name":"location","required":false},{"schema":{"type":"boolean"},"in":"query","name":"show_ooo","required":false},{"schema":{"type":"boolean"},"in":"query","name":"show_oos","required":false},{"schema":{"type":"boolean"},"in":"query","name":"include_closed","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"location":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"}}},"status":{"type":"string"},"reason":{"type":"object","properties":{"_id":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"}}},"from_date":{"type":"string"},"through_date":{"type":"string","nullable":true},"return_as":{"type":"string","nullable":true},"remarks":{"type":"string","nullable":true},"closed_at":{"type":"string","nullable":true},"closed_to_status":{"type":"string","nullable":true},"created_by":{"type":"string"},"closed_by":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}}}}}}}},"/locations/{siteId}/out-of-order-events/{eventId}":{"patch":{"tags":["Locations"],"description":"Update remarks / through_date / return_as on an out-of-order event (admin retrospective edit).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"remarks":{"type":"string","nullable":true},"through_date":{"type":"string","nullable":true},"return_as":{"type":"string","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"eventId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"location":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"}}},"status":{"type":"string"},"reason":{"type":"object","properties":{"_id":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"}}},"from_date":{"type":"string"},"through_date":{"type":"string","nullable":true},"return_as":{"type":"string","nullable":true},"remarks":{"type":"string","nullable":true},"closed_at":{"type":"string","nullable":true},"closed_to_status":{"type":"string","nullable":true},"created_by":{"type":"string"},"closed_by":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}}}}}}},"/notifications/subscribe":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["web","apns"]},"subscription":{"type":"object","properties":{"endpoint":{"type":"string"},"keys":{"type":"object","properties":{"p256dh":{"type":"string"},"auth":{"type":"string"}}}}},"token":{"type":"string"},"bundle_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/notifications/unsubscribe":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["web","apns"]},"endpoint":{"type":"string"},"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/notifications/verify":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["endpoint"],"properties":{"endpoint":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/people":{"get":{"tags":["People"],"description":"List people in a tenant (or in the tenant owning a given site).","parameters":[{"schema":{"type":"string"},"in":"query","name":"tenant","required":false},{"schema":{"type":"string"},"in":"query","name":"site","required":false},{"schema":{"type":"boolean"},"in":"query","name":"active","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"number"},"in":"query","name":"skip","required":false}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["People"],"description":"Create a new person (tenant-scoped, unique by student_id within tenant). Send `site` for permission checks; `tenant` is optional and defaults to that site's tenant.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","first_name","last_name","student_id"],"properties":{"tenant":{"type":"string"},"site":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"student_id":{"type":"string"},"email":{"type":"string"},"welfare_flag":{"type":"boolean"},"flags":{"type":"array","items":{"type":"string"}},"welfare_state":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/people/{personId}":{"get":{"tags":["People"],"description":"Retrieve a single person with active booking context.","parameters":[{"schema":{"type":"string"},"in":"path","name":"personId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["People"],"description":"Update a person.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site"],"properties":{"site":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"welfare_flag":{"type":"boolean"},"flags":{"type":"array","items":{"type":"string"}},"welfare_state":{"type":["string","null"]},"active":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"personId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["People"],"description":"Archive a person (soft delete).","parameters":[{"schema":{"type":"string"},"in":"query","name":"site","required":true},{"schema":{"type":"string"},"in":"path","name":"personId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/people/search":{"get":{"tags":["People"],"description":"Unified person search by id / name / email / active booking location.","parameters":[{"schema":{"type":"string"},"in":"query","name":"tenant","required":false},{"schema":{"type":"string"},"in":"query","name":"site","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["active_only","all","include_ancestors"]},"in":"query","name":"scope","required":false},{"schema":{"type":"boolean"},"in":"query","name":"include_checked_out","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/quality-gates/{siteId}":{"get":{"tags":["Quality Gates"],"description":"Get quality gate configurations for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["Quality Gates"],"description":"Create a quality gate configuration.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","rules"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"category_id":{"type":"string"},"severity":{"type":"string"},"rules":{"type":"object"},"enabled":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/quality-gates/{siteId}/{configId}":{"put":{"tags":["Quality Gates"],"description":"Update a quality gate configuration.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"category_id":{"type":"string"},"severity":{"type":"string"},"rules":{"type":"object"},"enabled":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"configId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Quality Gates"],"description":"Delete a quality gate configuration.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"configId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/rbac/roles":{"get":{"tags":["RBAC"],"description":"Get all available permissions and system role definitions.","responses":{"200":{"description":"Default Response"}}}},"/rbac/roles/{siteId}":{"get":{"tags":["RBAC"],"description":"List all roles configured for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["RBAC"],"description":"Create a new predefined role for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/rbac/roles/{siteId}/me":{"get":{"tags":["RBAC"],"description":"Get the current user's role and permissions for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/rbac/roles/{siteId}/{roleId}":{"patch":{"tags":["RBAC"],"description":"Update an existing role for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"roleId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["RBAC"],"description":"Delete a custom role from a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"roleId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/rbac/roles/{siteId}/{staffId}":{"put":{"tags":["RBAC"],"description":"Update a staff member role assignment.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["role_ids"],"properties":{"role_ids":{"type":"array","items":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"staffId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/block-bookings":{"get":{"tags":["Sites"],"description":"List block bookings for a site. Each row includes member counts and a status summary so the list view doesn't need a follow-up query.","parameters":[{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"boolean"},"in":"query","name":"archived","required":false},{"schema":{"type":"number"},"in":"query","name":"limit","required":false},{"schema":{"type":"number"},"in":"query","name":"skip","required":false},{"schema":{"type":"string","enum":["created_at","name","contract_start_min"]},"in":"query","name":"sort","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/cancellation-codes":{"get":{"tags":["Sites"],"description":"List cancellation codes for a site.","parameters":[{"schema":{"type":"boolean","default":false},"in":"query","name":"include_inactive","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}}},"post":{"tags":["Sites"],"description":"Create a new cancellation code for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","description"],"properties":{"code":{"type":"string","maxLength":16},"description":{"type":"string"},"sequence":{"type":"number","default":0},"inactive":{"type":"boolean","default":false}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}}},"/sites/{siteId}/cancellation-codes/{codeId}":{"patch":{"tags":["Sites"],"description":"Update a cancellation code. Code is immutable and cannot be changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"codeId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}},"delete":{"tags":["Sites"],"description":"Delete a cancellation code.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"codeId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["_id","deleted"]}}}}}}},"/sites/{siteId}/categories":{"post":{"tags":["Sites"],"description":"Create a new category for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}}},"/sites/{siteId}/categories/{categoryId}":{"get":{"tags":["Sites"],"description":"Retrieve a single incident category for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Sites"],"description":"Update a category for a site. Any subset of fields may be sent; only those provided are updated.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"it_map_string":{"type":"string"},"asset_action":{"type":"object","additionalProperties":false,"properties":{"allow_tagging":{"type":"boolean"},"required":{"type":"boolean"},"allowed_classes":{"type":"array","items":{"type":"string"}},"allowed_categories":{"type":"array","items":{"type":"string"}},"action_type":{"type":"string","enum":["none","move","dispose","change_status"]},"trigger_status_key":{"type":"string"},"destination_required":{"type":"boolean"},"disposal_reason_required":{"type":"boolean"},"approval_required":{"type":"boolean"},"resulting_asset_status_key":{"type":"string"}}},"flushing":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean"}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Sites"],"description":"Remove a category from a site. Reassigns incidents if needed, archives or fully deletes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reassign_to":{"type":"string"},"permanent":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["_id","name","colour"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"requires_reassignment":{"type":"boolean"},"incident_count":{"type":"number"}}}}}}}}},"/sites/{siteId}/categories/{categoryId}/restore":{"post":{"tags":["Sites"],"description":"Restore an archived category back to a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"it_map_string":{"type":"string"}},"required":["_id","name","colour"]}}}}}}},"/sites/":{"post":{"tags":["Sites"],"description":"Create a new site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","created_by","created_at","updated_at"]}}}}}},"get":{"tags":["Sites"],"description":"Retrieve a list of sites the user has access to.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"logo_url":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","created_at","updated_at"]}}}}}}}},"/sites/{siteId}/flag-types":{"post":{"tags":["Sites"],"description":"Create a new flag type for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}}},"/sites/{siteId}/flag-types/{flagTypeId}":{"patch":{"tags":["Sites"],"description":"Update a flag type for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"flagTypeId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}},"delete":{"tags":["Sites"],"description":"Remove a flag type from a site. Archives or fully deletes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"permanent":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"flagTypeId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["_id","name","colour"]}}}}}}},"/sites/{siteId}/flag-types/{flagTypeId}/restore":{"post":{"tags":["Sites"],"description":"Restore an archived flag type back to a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"flagTypeId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour"]}}}}}}},"/sites/{siteId}/housekeeping-tasks":{"get":{"tags":["Sites"],"description":"List housekeeping tasks for a site.","parameters":[{"schema":{"type":"boolean","default":false},"in":"query","name":"include_inactive","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"instructions":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","instructions","sequence","inactive"]}}}}}}},"post":{"tags":["Sites"],"description":"Create a new housekeeping task for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","description"],"properties":{"code":{"type":"string","maxLength":16},"description":{"type":"string"},"instructions":{"type":"string"},"sequence":{"type":"number","default":0},"inactive":{"type":"boolean","default":false}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"instructions":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","instructions","sequence","inactive"]}}}}}}},"/sites/{siteId}/housekeeping-tasks/{taskId}":{"patch":{"tags":["Sites"],"description":"Update a housekeeping task. Code is immutable and cannot be changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string"},"instructions":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"taskId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"instructions":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","instructions","sequence","inactive"]}}}}}},"delete":{"tags":["Sites"],"description":"Delete a housekeeping task.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"taskId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["_id","deleted"]}}}}}}},"/sites/{siteId}/incident-forms":{"post":{"tags":["Sites"],"description":"Create a new incident form for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/incident-forms/{formId}":{"patch":{"tags":["Sites"],"description":"Update an incident form for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"formId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["Sites"],"description":"Delete an incident form for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"formId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/location-types":{"get":{"tags":["Sections"],"description":"Get all location types for a site","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"parent":{"type":"string"},"cleaning_type":{"type":"string","enum":["daily","weekly","monthly","routine","on_vacancy","on_zone_empty"]},"can_be_allocated_to_bookings":{"type":"boolean"}},"required":["_id","name","colour","can_be_allocated_to_bookings"]}}}}}}},"post":{"tags":["Sections"],"description":"Create a new location type for a site","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"parent":{"type":"string"},"cleaning_type":{"type":"string","enum":["daily","weekly","monthly","routine","on_vacancy","on_zone_empty",null],"nullable":true},"can_be_allocated_to_bookings":{"type":"boolean"}},"required":["name","colour","can_be_allocated_to_bookings"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"can_be_allocated_to_bookings":{"type":"boolean"}},"required":["_id","name","colour","can_be_allocated_to_bookings"]}}}}}}},"/sites/{siteId}/location-types/{locationTypeId}":{"patch":{"tags":["Sections"],"description":"Update a location type for a site","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"colour":{"type":"string"},"parent":{"type":"string"},"cleaning_type":{"type":"string","enum":["daily","weekly","monthly","routine","on_vacancy","on_zone_empty",null],"nullable":true},"can_be_allocated_to_bookings":{"type":"boolean"}},"required":["name","colour","can_be_allocated_to_bookings"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationTypeId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"}}}}}}}},"delete":{"tags":["Sections"],"description":"Delete a location type for a site","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"locationTypeId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/logo":{"post":{"tags":["Sites"],"description":"Generate a presigned URL for a site logo upload.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content_type"],"properties":{"content_type":{"type":"string","enum":["image/png","image/jpeg","image/jpg","image/svg+xml","image/webp"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"object_id":{"type":"string"}},"required":["url","object_id"]}}}}}},"put":{"tags":["Sites"],"description":"Persist an uploaded site logo.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["object_id"],"properties":{"object_id":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"raw_url":{"type":"string"},"source_uri":{"type":"string"},"uploaded":{"type":"boolean"},"object_id":{"type":"string"}},"required":["raw_url","source_uri","uploaded","object_id"]}}}}}}},"/sites/{siteId}/no-service-reasons":{"get":{"tags":["Sites"],"description":"List no-service reasons for a site.","parameters":[{"schema":{"type":"boolean","default":false},"in":"query","name":"include_inactive","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}}},"post":{"tags":["Sites"],"description":"Create a new no-service reason for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","description"],"properties":{"code":{"type":"string","maxLength":20},"description":{"type":"string","maxLength":2000},"sequence":{"type":"number","default":0},"inactive":{"type":"boolean","default":false}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}}},"/sites/{siteId}/no-service-reasons/{reasonId}":{"patch":{"tags":["Sites"],"description":"Update a no-service reason. Code is immutable and cannot be changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","maxLength":2000},"sequence":{"type":"number"},"inactive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"reasonId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}},"delete":{"tags":["Sites"],"description":"Delete a no-service reason.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"reasonId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["_id","deleted"]}}}}}}},"/sites/{siteId}/out-of-order-reasons":{"get":{"tags":["Sites"],"description":"List out-of-order/out-of-service reasons for a site.","parameters":[{"schema":{"type":"boolean","default":false},"in":"query","name":"include_inactive","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","enum":["out_of_order","out_of_service"]}},"required":["_id","code","description","sequence","inactive","type"]}}}}}}},"post":{"tags":["Sites"],"description":"Create a new out-of-order reason for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","description","type"],"properties":{"code":{"type":"string","maxLength":16},"description":{"type":"string"},"sequence":{"type":"number","default":0},"inactive":{"type":"boolean","default":false},"type":{"type":"string","enum":["out_of_order","out_of_service"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","enum":["out_of_order","out_of_service"]}},"required":["_id","code","description","sequence","inactive","type"]}}}}}}},"/sites/{siteId}/out-of-order-reasons/{reasonId}":{"patch":{"tags":["Sites"],"description":"Update an out-of-order reason. Code is immutable and cannot be changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"type":{"type":"string","enum":["out_of_order","out_of_service"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"reasonId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","enum":["out_of_order","out_of_service"]}},"required":["_id","code","description","sequence","inactive","type"]}}}}}},"delete":{"tags":["Sites"],"description":"Delete an out-of-order reason.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"reasonId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["_id","deleted"]}}}}}}},"/sites/{siteId}/people/resolve":{"post":{"tags":["Sites"],"description":"Resolve a list of identifiers (student IDs and/or emails) to people in the site's tenant. Used by the bulk booking paste/upload flow to map raw input to person records.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["identifiers"],"properties":{"identifiers":{"type":"array","minItems":1,"maxItems":2000,"items":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/priorities":{"post":{"tags":["Sites"],"description":"Create a new priority for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"},"notify":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"notify":{"type":"boolean"}},"required":["_id","name","colour","created_at","updated_at","notify"]}}}}}}},"/sites/{siteId}/priorities/{priorityId}":{"patch":{"tags":["Sites"],"description":"Update a priority for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"},"notify":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"priorityId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"notify":{"type":"boolean"}},"required":["_id","name","colour","created_at","updated_at","notify"]}}}}}},"delete":{"tags":["Sites"],"description":"Remove a priority from a site. Reassigns incidents if needed, archives or fully deletes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reassign_to":{"type":"string"},"permanent":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"priorityId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"notify":{"type":"boolean"},"deleted":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["_id","name","colour"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"requires_reassignment":{"type":"boolean"},"incident_count":{"type":"number"}}}}}}}}},"/sites/{siteId}/priorities/{priorityId}/restore":{"post":{"tags":["Sites"],"description":"Restore an archived priority back to a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"priorityId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"notify":{"type":"boolean"}},"required":["_id","name","colour"]}}}}}}},"/sites/{siteId}":{"get":{"tags":["Sites"],"description":"Retrieve a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"incident_tracker_main_location_id":{"type":"string"},"default_status_pipeline":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"position":{"type":"number"},"is_terminal":{"type":"boolean"}}}},"categories":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"it_map_string":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"},"asset_action":{"type":"object","properties":{"allow_tagging":{"type":"boolean"},"required":{"type":"boolean"},"allowed_classes":{"type":"array","items":{"type":"string"}},"allowed_categories":{"type":"array","items":{"type":"string"}},"action_type":{"type":"string"},"trigger_status_key":{"type":"string"},"destination_required":{"type":"boolean"},"disposal_reason_required":{"type":"boolean"},"approval_required":{"type":"boolean"},"resulting_asset_status_key":{"type":"string"}}},"flushing":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"status_pipeline":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"position":{"type":"number"},"is_terminal":{"type":"boolean"}}}}},"required":["_id","name","colour"]}},"sources":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour"]}},"priorities":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"archived":{"type":"boolean"},"notify":{"type":"boolean"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour","archived","notify"]}},"archived_categories":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"it_map_string":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"asset_action":{"type":"object","properties":{"allow_tagging":{"type":"boolean"},"required":{"type":"boolean"},"allowed_classes":{"type":"array","items":{"type":"string"}},"allowed_categories":{"type":"array","items":{"type":"string"}},"action_type":{"type":"string"},"trigger_status_key":{"type":"string"},"destination_required":{"type":"boolean"},"disposal_reason_required":{"type":"boolean"},"approval_required":{"type":"boolean"},"resulting_asset_status_key":{"type":"string"}}}},"required":["_id","name","colour"]}},"archived_sources":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour"]}},"archived_priorities":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"archived":{"type":"boolean"},"notify":{"type":"boolean"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}}},"required":["_id","name","colour"]}},"flag_types":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour"]}},"welfare_states":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour"]}},"archived_flag_types":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour"]}},"archived_welfare_states":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"can_delete":{"type":"boolean"}},"required":["_id","name","colour"]}},"incident_forms":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"site":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}},"fields":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string"},"required":{"type":"boolean"},"options":{"type":"array","items":{"type":"string"}},"allow_other":{"type":"boolean"},"order":{"type":"number"}}}},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}},"photo_url":{"type":"string"},"logo_url":{"type":"string"},"permission":{"type":"string"},"flushing_settings":{"type":"object","nullable":true,"properties":{"default_duration_seconds":{"type":"number"},"require_turn_off_confirmation":{"type":"boolean"},"occupied_follow_up_category_id":{"type":"string","nullable":true},"guest_incident_category_id":{"type":"string","nullable":true},"occupied_blocks_completion":{"type":"boolean"},"allow_unmatched_locations":{"type":"boolean"},"allow_skip_assets":{"type":"boolean"},"require_exception_notes":{"type":"boolean"},"require_exception_photos":{"type":"boolean"},"allow_mark_unflushable":{"type":"boolean"},"require_unflushable_notes":{"type":"boolean"},"require_unflushable_photos":{"type":"boolean"},"unflushable_follow_up_category_id":{"type":"string","nullable":true},"create_follow_up_on_unflushable":{"type":"boolean"},"kitchen_erp_suffix":{"type":"string"},"kitchen_location_type_id":{"type":"string","nullable":true},"grouping_location_type_id":{"type":"string","nullable":true}}}},"required":["name","created_by","created_at","updated_at","default_status_pipeline","categories","sources","priorities","permission"]}}}}}},"patch":{"tags":["Sites"],"description":"Update a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"photo_url":{"type":"string"},"logo_url":{"type":"string"},"incident_tracker_main_location_id":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"photo_url":{"type":"string"},"logo_url":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"incident_tracker_main_location_id":{"type":"string"}},"required":["_id","name","created_by","created_at","updated_at"]}}}}}}},"/sites/{siteId}/room-move-reasons":{"get":{"tags":["Sites"],"description":"List room move reasons for a site.","parameters":[{"schema":{"type":"boolean","default":false},"in":"query","name":"include_inactive","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}}},"post":{"tags":["Sites"],"description":"Create a new room move reason for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","description"],"properties":{"code":{"type":"string","maxLength":16},"description":{"type":"string"},"sequence":{"type":"number","default":0},"inactive":{"type":"boolean","default":false}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}}},"/sites/{siteId}/room-move-reasons/{reasonId}":{"patch":{"tags":["Sites"],"description":"Update a room move reason. Code is immutable and cannot be changed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"reasonId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"sequence":{"type":"number"},"inactive":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","code","description","sequence","inactive"]}}}}}},"delete":{"tags":["Sites"],"description":"Delete a room move reason.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"reasonId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["_id","deleted"]}}}}}}},"/sites/{siteId}/sources":{"post":{"tags":["Sites"],"description":"Create a new source for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}}},"/sites/{siteId}/sources/{sourceId}":{"patch":{"tags":["Sites"],"description":"Update a source for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"sourceId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}},"delete":{"tags":["Sites"],"description":"Remove a source from a site. Reassigns incidents if needed, archives or fully deletes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reassign_to":{"type":"string"},"permanent":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"sourceId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["_id","name","colour"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"requires_reassignment":{"type":"boolean"},"incident_count":{"type":"number"}}}}}}}}},"/sites/{siteId}/sources/{sourceId}/restore":{"post":{"tags":["Sites"],"description":"Restore an archived source back to a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"sourceId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour"]}}}}}}},"/sites/{siteId}/status-pipeline":{"get":{"tags":["Sites"],"description":"Get the site default status pipeline.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Sites"],"description":"Update the site default status pipeline.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["statuses"],"properties":{"statuses":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"position":{"type":"number"},"is_terminal":{"type":"boolean"}},"required":["key","name","colour","position","is_terminal"]}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/categories/{categoryId}/status-pipeline":{"patch":{"tags":["Sites"],"description":"Set or clear a site-specific category status pipeline override.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["statuses"],"properties":{"statuses":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"position":{"type":"number"},"is_terminal":{"type":"boolean"}},"required":["key","name","colour","position","is_terminal"]}},{"type":"null"}]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/flushing-settings":{"patch":{"tags":["Sites"],"description":"Update flushing (Legionella) settings for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"default_duration_seconds":{"type":"number"},"require_turn_off_confirmation":{"type":"boolean"},"occupied_follow_up_category_id":{"type":["string","null"]},"guest_incident_category_id":{"type":["string","null"]},"occupied_blocks_completion":{"type":"boolean"},"allow_unmatched_locations":{"type":"boolean"},"allow_skip_assets":{"type":"boolean"},"require_exception_notes":{"type":"boolean"},"require_exception_photos":{"type":"boolean"},"allow_mark_unflushable":{"type":"boolean"},"require_unflushable_notes":{"type":"boolean"},"require_unflushable_photos":{"type":"boolean"},"unflushable_follow_up_category_id":{"type":["string","null"]},"create_follow_up_on_unflushable":{"type":"boolean"},"kitchen_erp_suffix":{"type":"string"},"kitchen_location_type_id":{"type":["string","null"]},"grouping_location_type_id":{"type":["string","null"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sites/{siteId}/welfare-states":{"post":{"tags":["Sites"],"description":"Create a new welfare state for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}}},"/sites/{siteId}/welfare-states/{welfareStateId}":{"patch":{"tags":["Sites"],"description":"Update a welfare state for a site.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","colour"],"properties":{"name":{"type":"string"},"colour":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"welfareStateId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour","created_at","updated_at"]}}}}}},"delete":{"tags":["Sites"],"description":"Remove a welfare state from a site. Archives or fully deletes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"permanent":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"welfareStateId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["_id","name","colour"]}}}}}}},"/sites/{siteId}/welfare-states/{welfareStateId}/restore":{"post":{"tags":["Sites"],"description":"Restore an archived welfare state back to a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"welfareStateId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"},"sites":{"type":"array","items":{"type":"string"}},"archived_sites":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["_id","name","colour"]}}}}}}},"/sla-policies/{siteId}":{"get":{"tags":["SLA Policies"],"description":"List all SLA policies for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"tags":["SLA Policies"],"description":"Create a new SLA policy.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","category_ids","targets"],"properties":{"name":{"type":"string"},"category_ids":{"type":"array","items":{"type":"string"}},"targets":{"type":"object","properties":{"first_response":{"type":"object","properties":{"hours":{"type":"number"},"minutes":{"type":"number"}},"required":["hours","minutes"]},"resolution":{"type":"object","properties":{"hours":{"type":"number"},"minutes":{"type":"number"}},"required":["hours","minutes"]},"escalation":{"type":"object","properties":{"hours":{"type":"number"},"minutes":{"type":"number"}},"required":["hours","minutes"]},"business_hours_only":{"type":"boolean"}}},"enabled":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/sla-policies/{siteId}/{policyId}":{"put":{"tags":["SLA Policies"],"description":"Update an SLA policy.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"category_ids":{"type":"array","items":{"type":"string"}},"targets":{"type":"object","properties":{"first_response":{"type":"object","properties":{"hours":{"type":"number"},"minutes":{"type":"number"}},"required":["hours","minutes"]},"resolution":{"type":"object","properties":{"hours":{"type":"number"},"minutes":{"type":"number"}},"required":["hours","minutes"]},"escalation":{"type":"object","properties":{"hours":{"type":"number"},"minutes":{"type":"number"}},"required":["hours","minutes"]},"business_hours_only":{"type":"boolean"}}},"enabled":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"policyId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["SLA Policies"],"description":"Delete an SLA policy.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"policyId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/staff":{"post":{"tags":["Staff"],"description":"Create a new staff member.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","first_name","last_name","role_ids"],"properties":{"site":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"job_title":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"job_title":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string"},"requires_email":{"type":"boolean"}}}},"user_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","site","first_name","last_name","created_at","updated_at","photo_url"]}}}}}}},"/staff/{siteId}/{userId}":{"delete":{"tags":["Staff"],"description":"Delete a staff member from a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}},"patch":{"tags":["Staff"],"description":"Update a staff member.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["first_name","last_name","role_ids"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"job_title":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"job_title":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string"},"requires_email":{"type":"boolean"}}}},"user_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","site","first_name","last_name","created_at","updated_at","photo_url"]}}}}}}},"/staff/{siteId}":{"get":{"tags":["Staff"],"description":"Retrieve a list of staff members for a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"job_title":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string"},"requires_email":{"type":"boolean"}}}},"user_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","site","first_name","last_name","created_at","updated_at","photo_url"]}}}}}}}},"/students":{"post":{"tags":["Students"],"description":"Create a new student.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["site","first_name","last_name","location"],"properties":{"site":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"site":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"},"record_name":{"type":"string"},"type":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"photo_url":{"type":"string"}},"required":["_id","site","first_name","last_name","location","student_id","record_name","type","created_at","updated_at"]}}}}}}},"/students/{siteId}/{userId}":{"delete":{"tags":["Students"],"description":"Delete a student from a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}},"patch":{"tags":["Students"],"description":"Update a student.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["first_name","last_name","location"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"},"welfare_flag":{"type":"boolean"},"flags":{"type":"array","items":{"type":"string"}},"welfare_state":{"type":["string","null"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/students/{site}/export-csv":{"get":{"tags":["Students"],"description":"Export a list of students as a CSV file.","parameters":[{"schema":{"type":"string","enum":["first_name","last_name","location"]},"in":"query","name":"sortBy","required":false},{"schema":{"type":"string"},"in":"path","name":"site","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/students/{site}/export":{"get":{"tags":["Students"],"description":"Export a list of students as a PDF.","parameters":[{"schema":{"type":"string","enum":["first_name","last_name","location"]},"in":"query","name":"sortBy","required":false},{"schema":{"type":"boolean","default":false},"in":"query","name":"includePhoto","required":false},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/students/{site}/import":{"post":{"tags":["Students"],"description":"Import a list of students.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"students":{"type":"array","items":{"type":"object","required":["first_name","last_name","location"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"}}}},"type":{"type":"string","enum":["full","partial"]}},"required":["students","type"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"site","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"students":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"},"site":{"type":"string"},"active":{"type":"boolean"}}},"required":["_id","first_name","last_name","location","student_id","site","active"]},"exceptions":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"},"cause":{"type":"string"},"existing_record_id":{"type":"string"}},"required":["first_name","last_name","location","student_id","cause"]}}}}}}}}}},"/students/{siteId}":{"get":{"tags":["Students"],"description":"Retrieve all students from a site.","parameters":[{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"record_name":{"type":"string"},"location":{"type":"string"},"student_id":{"type":"string"},"floor":{"type":"string"},"email":{"type":"string"},"photo_url":{"type":"string"},"site":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"welfare_flag":{"type":"boolean"},"flags":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"}},"required":["_id","name","colour"]}},"welfare_state":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"colour":{"type":"string"}},"required":["_id","name","colour"]}},"required":["_id","first_name","last_name","record_name","location","site","created_at","updated_at","type","active","welfare_flag"]}}}}}}}},"/tenants":{"get":{"tags":["Tenants"],"description":"List all tenants.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"photo_url_template":{"type":"string"},"site_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}}}}}}},"post":{"tags":["Tenants"],"description":"Create a tenant.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"photo_url_template":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/tenants/{tenantId}":{"get":{"tags":["Tenants"],"description":"Retrieve a single tenant.","parameters":[{"schema":{"type":"string"},"in":"path","name":"tenantId","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"tags":["Tenants"],"description":"Update a tenant.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"photo_url_template":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"tenantId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/tenants/{tenantId}/sites/{siteId}":{"post":{"tags":["Tenants"],"description":"Assign a site to a tenant.","parameters":[{"schema":{"type":"string"},"in":"path","name":"tenantId","required":true},{"schema":{"type":"string"},"in":"path","name":"siteId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/users/@me":{"get":{"tags":["Auth"],"description":"Retrieve the user's own profile.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string"},"last_site":{"type":"string"}},"required":["_id","email","first_name","last_name","photo_url"]}}}}}}},"/users/avatar":{"post":{"tags":["Auth"],"description":"Generate a presigned URL for a user avatar","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content_type"],"properties":{"content_type":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"object_id":{"type":"string"}},"required":["url","object_id"]}}}}}},"put":{"tags":["Auth"],"description":"Upload a user avatar","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["object_id"],"properties":{"object_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"raw_url":{"type":"string"},"source_uri":{"type":"string"},"uploaded":{"type":"boolean"},"object_id":{"type":"string"}},"required":["raw_url","source_uri","uploaded","object_id"]}}}}}}},"/users/@me/hint":{"patch":{"tags":["Auth"],"description":"Set the last site hint for a user.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"site_id":{"type":"string"}},"required":["site_id"]}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/users/preferences":{"get":{"description":"Get user preferences","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"colour_blind":{"type":"boolean"},"use_mailto":{"type":"boolean"},"sidebar_width":{"type":"number"},"ai_summary_collapsed":{"type":"boolean"},"version_flag":{"type":"number"},"version_flag_updated":{"type":"boolean"},"incident_tracker_username":{"type":"string","nullable":true}}}}}}}},"patch":{"description":"Update user preferences","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"colour_blind":{"type":"boolean"},"use_mailto":{"type":"boolean"},"sidebar_width":{"type":"number","minimum":250,"maximum":600},"ai_summary_collapsed":{"type":"boolean"}},"minProperties":1}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"colour_blind":{"type":"boolean"},"use_mailto":{"type":"boolean"},"sidebar_width":{"type":"number"},"ai_summary_collapsed":{"type":"boolean"}}}}}}}}},"/users/integrations/{userId}/incident-tracker":{"post":{"tags":["Users"],"description":"Integrate with Incident Tracker","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string"},"password":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}}}},"delete":{"tags":["Users"],"description":"Remove integration with Incident Tracker","parameters":[{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}}}}}},"servers":[{"url":"https://api.kitehouse.co.uk"}]}