{"swagger":"2.0","info":{"description":"# AIIO Polaris Backend API\n\nBackend REST API for the AIIO Polaris process-management platform. Multi-tenant Go service that backs the Polaris frontend and exposes the same endpoints to programmatic clients (Personal Access Tokens, AI agents).\n\n## Authentication\n\nSend `Authorization: Bearer <token>` on every request. Two token kinds are accepted:\n- **Clerk JWT** — `eyJ...` style. Obtained via the normal Clerk login flow. Endpoints that require an organization context resolve the active org from the JWT.\n- **Personal Access Token (PAT)** — `pat_{org-slug}_{secret}`. The org slug embedded in the token also selects the tenant DB. PATs additionally honor `RequiredScopes` (see each endpoint). A `write` scope implicitly grants `read` on the same domain.\n\n## Identifiers and naming\n\n- All entity IDs returned by the API are **UUID v4 strings** (e.g. `b5e0a1f4-9c0c-4f0f-9aa0-7c1a8b6f4d22`). Send them back verbatim in path params and JSON bodies.\n- User IDs are Clerk external IDs (`user_xxxxxxxx`). They are accepted wherever a user reference is needed (including assignment `targetContainerId`); the backend resolves them to the internal user UUID.\n- Entity-type discriminators are snake_case strings (`process`, `process_group`, `department`, `organization_profile`, …). Never abbreviate or change case.\n\n## Shared list query parameters\n\nAll list endpoints (`GET /processes`, `GET /resources`, …) accept the same query parameters:\n\n- `page` (int, default `1`, min `1`)\n- `size` (int, default `20`, min `1`, max `100`)\n- `orderBy` (string) — `field asc|desc`, comma-separate for multiple sort keys.\n- `filter` (repeatable string) — `field operator value`. Operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like` (case- and diacritic-insensitive substring). Pass the parameter multiple times to AND filters together.\n- `search` (string) — free-text across name and a domain-specific set of related fields. Multiple whitespace-separated terms are ANDed. Diacritic-insensitive.\n- `searchExclude` (repeatable string) — drop named search scopes (e.g. `searchExclude=owner,participants`).\n- `includes` (repeatable string) — embed related assignment summaries on each item; see \"Includes\" below.\n\nFilterable/sortable field lists are per-endpoint; see each `GET` description.\n\n## Assignments — request payload shape\n\nSeveral domains (process, resource, location, requirement, organization_profile) accept an `assignments` field on POST and PUT. **Two shapes exist** — check the per-endpoint description to know which one the route expects:\n\n### Shape A — Nested map (process, organization_profile)\n\nTwo-level map keyed by relation type, then by entity-type plural. Supports partial-update merge semantics:\n\n```json\n{\n\"assignments\": {\n\"owner\": {\n\"users\": [{\"targetContainerId\": \"user_2abc...\"}],\n\"organizationProfiles\": [{\"targetContainerId\": \"b5e0a1f4-...\"}]\n},\n\"assigned\": {\n\"resources\": [{\"targetContainerId\": \"9b9a...\"}],\n\"locations\": [{\"targetContainerId\": \"0e1f...\"}]\n}\n}\n}\n```\n\n**Allowed relation types** (outer keys): `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed`, `happensIn`, `assigned`, `involved`, `participant`, `member`, `contributing`.\n\n**Allowed entity-type plurals** (inner keys): `processes`, `resources`, `locations`, `requirements`, `users`, `organizationProfiles`, `bpmnNodes`. Not every relation accepts every entity type — see the per-relation source→target table below.\n\n**Entry shape**: `{\"targetContainerId\": \"<uuid-or-external-id>\", \"contextContainerId\": \"<uuid>\"?}`. `contextContainerId` is only used for context-scoped assignments (currently BPMN nodes); omit otherwise.\n\n**Merge semantics on PUT** (partial updates):\n- Outer key absent → that relation is **preserved** unchanged.\n- Outer key present with `{}` → that relation is **cleared** for all entity types.\n- Inner key absent within a present relation → that entity type is preserved.\n- Inner key present with entries → entries **replace** that entity type's set.\n- Inner key present with `[]` → that entity type is cleared, other entity types in the same relation are preserved.\n\nOn POST (create) the same map shape is used but all keys are additive (there is no existing state to merge against).\n\n### Shape B — Flat array (location, resource, requirement)\n\nA plain array of explicit entries — no merge semantics. Sending `assignments` on PUT **replaces** the entire assignment set; omit the field to leave assignments untouched.\n\n```json\n{\n\"assignments\": [\n{\"relationType\": \"owner\",    \"targetType\": \"user\",                \"targetContainerId\": \"user_2abc...\"},\n{\"relationType\": \"assigned\", \"targetType\": \"process\",             \"targetContainerId\": \"b5e0a1f4-...\"},\n{\"relationType\": \"happensIn\",\"targetType\": \"location\",            \"targetContainerId\": \"0e1f-...\"}\n]\n}\n```\n\n`targetType` must be a singular entity type (`process`, `resource`, `location`, `requirement`, `user`, `organization_profile`). `relationType` must be one of the allowed relations for the (source, target) combination — same registry as Shape A.\n\n## Relation registry — which targets each relation accepts per source\n\nSending an invalid (source, relation, target) triple returns `400 Validation` with code `assignment.invalid_combination`.\n\n| Relation | Source entity | Allowed targets |\n|---|---|---|\n| `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed` | process, resource, location, requirement, organization_profile, bpmn_node | user, organization_profile |\n| `participant` | process | user, organization_profile |\n| `happensIn` (bidirectional) | process, bpmn_node, organization_profile | location |\n| `assigned` (bidirectional) | process | resource, location, requirement |\n| `assigned` (bidirectional) | resource | process, location, requirement |\n| `assigned` (bidirectional) | location | process, resource, requirement |\n| `assigned` (bidirectional) | requirement | process, resource, location |\n| `assigned` (bidirectional) | organization_profile | resource, organization_profile |\n| `involved` | bpmn_node | resource, requirement |\n| `member` | organization_profile | user, organization_profile |\n| `contributing` | organization_profile | organization_profile |\n\nBidirectional relations are auto-mirrored: sending `assigned.resources` from a process also surfaces that process under the resource's `assigned.processes` on read.\n\n## Includes — embedding assignment summaries on reads\n\nPass `includes=<relation>[,<relation>...]` on list and detail GETs to populate the response `assignments` field.\n- Plain relation: `includes=owner,assigned` returns every entity type under each relation.\n- Dot notation narrows to one entity type: `includes=assigned.resources` returns only resources assigned to the entity.\n- For organization_profile detail GETs, the reverse-include keys `linkedProcesses`, `linkedRequirements`, `linkedResources`, `linkedLocations` surface entities that point AT the profile (used to populate the \"Linked X\" tabs).\n\nProcess detail also supports `bpmnIncludes=<relation>[.<entityPlural>]?` to embed BPMN-node-level assignment summaries (only `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed`, `happensIn`, `involved` are valid here).\n\n## Versioning entities and entity types\n\nProcess, location, resource, requirement, and organization_profile are **versioned**. POST creates the first version; PUT creates a new version (it does not mutate the previous one) and the response reflects the new `versionNumber` and `versionStatus` (`new` or `approved`).\n\nEach versioned domain carries an `entityType` discriminator:\n- process: `process` or `process_group`\n- organization_profile: `department`, `role`, `staff_position`, `external_partner`, `working_group` (and the system-managed `org_chart` root)\n- resource, location, requirement: single fixed value matching the domain name\n\n## ETags and conditional updates\n\nDetail GETs return `ETag` headers; sending `If-None-Match: <etag>` yields `304 Not Modified`. For writes, sending `If-Match: <etag>` enables optimistic concurrency — a stale ETag returns `412 Precondition Failed`.\n\n## Error model\n\nAll errors return JSON: `{\"code\": \"<domain>.<reason>\", \"message\": \"human readable\", \"correlationId\": \"<req-id>\"}`. Status mapping: `400` validation, `401` unauthenticated, `403` forbidden / auth, `404` not found, `409` conflict, `412` precondition failed, `500` internal. Treat `code` as the stable contract; `message` is for humans.","title":"AIIO Polaris Backend API","termsOfService":"http://swagger.io/terms/","contact":{"name":"API Support","url":"http://www.swagger.io/support","email":"support@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"version":"0.1"},"host":"localhost:8080","basePath":"/api/v1","paths":{"/api-keys":{"get":{"security":[{"BearerAuth":[]}],"description":"List API key metadata for the current organization. A regular user sees only their own keys; admins see every key in the org. Secrets are **never** returned — only metadata (`id`, `name`, `scopes`, `createdAt`, `expiresAt`, `lastUsedAt`, `revokedAt`). Use `POST /api-keys` to issue a new key (the secret appears only in the create response).\n\n**PAT access**: Not available — this endpoint is restricted to Clerk-authenticated users so PATs cannot enumerate or self-manage tokens.","produces":["application/json"],"tags":["api-keys"],"summary":"List API keys","responses":{"200":{"description":"OK","schema":{"type":"array","items":{"$ref":"#/definitions/dtos.ApiKeyDto"}}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Issue a new Personal Access Token (PAT) for programmatic API access. **The secret is returned only once in this response** — under `token` / `secret`; subsequent reads only return metadata. Persist the value securely (e.g. a secret manager) before closing the response.\n\nBody fields:\n- `name` (required) — human-friendly label (e.g. \"CI ingestion bot\").\n- `scopes` (required, min 1) — list of `{domain}:{action}` strings the token may use. `action` is `read` or `write`; `write` implies `read` on the same domain. Domains: `process`, `resource`, `location`, `requirement`, `organization_profile`, `assignment`, `bpmn`, `org_chart`, `user`. Examples: `[\"process:write\", \"resource:read\"]`.\n- `expiresAt` (optional, RFC3339) — UTC expiry. Omit for a non-expiring token (security-sensitive — prefer a date).\n\nSend the resulting token to authenticated endpoints as `Authorization: Bearer pat_{org-slug}_{secret}`. PAT auth is restricted by `RequiredScopes` on each endpoint; Clerk JWTs are not scope-checked.\n\nAvailable to any authenticated org member (Viewer+); a user's tokens are listed/revoked by that user (admins see all).","consumes":["application/json"],"produces":["application/json"],"tags":["api-keys"],"summary":"Create a new API key","parameters":[{"description":"API key data","name":"apiKey","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.CreateApiKeyRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.ApiKeyCreatedDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/api-keys/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Return metadata for a single API key (`id`, `name`, `scopes`, `createdAt`, `expiresAt`, `lastUsedAt`, `revokedAt`). **The secret value is never returned** — it is only exposed once, in the response to `POST /api-keys`. A regular user can only get their own keys; admins can get any.\n\n**PAT access**: Not available — token management is restricted to Clerk users.","produces":["application/json"],"tags":["api-keys"],"summary":"Get an API key by ID","parameters":[{"type":"string","description":"API Key ID (UUID)","name":"id","in":"path","required":true}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.ApiKeyDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"delete":{"security":[{"BearerAuth":[]}],"description":"Revoke a Personal Access Token immediately. After this call, any request using the token returns `401`. Revocation sets `revokedAt` on the record but keeps the row for audit. Users can revoke their own keys; admins can revoke any. Re-revoking returns `204` and is a no-op.\n\n**PAT access**: Not available — a PAT cannot revoke itself or others.","produces":["application/json"],"tags":["api-keys"],"summary":"Revoke an API key","parameters":[{"type":"string","description":"API Key ID (UUID)","name":"id","in":"path","required":true}],"responses":{"204":{"description":"Successfully revoked"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/assignments":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all entity assignments with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*Assignment Fields*:\n- `id` (string): eq, neq\n- `sourceType` (string): eq, neq\n- `sourceId` (string): eq, neq\n- `sourceContainerId` (string): eq, neq\n- `targetType` (string): eq, neq\n- `targetContainerId` (string): eq, neq\n- `relationType` (string): eq, neq, like\n- `createdBy` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n*User Fields*:\n- `createdByName` (string): eq, neq, like\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Examples**:\n- All assignments for a target: `filter=targetContainerId eq <uuid>`\n- All assignments of a type for a source version: `filter=sourceId eq <uuid>&filter=targetType eq process`","produces":["application/json"],"tags":["assignments"],"summary":"Get all assignments with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria","name":"filter","in":"query"},{"type":"string","description":"Sort order","name":"orderBy","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-assignment_AssignmentDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/assignments/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a single assignment record by its UUID. Returns the raw assignment row: `id`, `sourceType`, `sourceId`, `sourceContainerId`, `targetType`, `targetContainerId`, `relationType`, `contextContainerId`, `createdBy`, `createdAt`. This is the low-level join row — most callers should use the `assignments` field embedded in entity reads via `includes` instead.","produces":["application/json"],"tags":["assignments"],"summary":"Get a single assignment by ID","parameters":[{"type":"string","description":"Assignment ID (UUID)","name":"id","in":"path","required":true}],"responses":{"200":{"description":"Successfully retrieved the assignment","schema":{"$ref":"#/definitions/assignment.AssignmentDto"}},"400":{"description":"Invalid assignment ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Assignment not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/audit-logs":{"get":{"security":[{"BearerAuth":[]}],"description":"Returns a paginated list of audit log entries scoped to the authenticated tenant.\n\n**Filtering**: Use the `filter` query parameter. Format: `filter=field operator value`\n\n**Filterable fields**: timestamp (time), userFullName (string), actorType (eq),\nentityType (eq), entityId (int eq), actionType (eq), status (eq), description (string)\n\n**Pagination**: `page` (default: 1) and `size` (default: 50, max: 100)\n\n**Sorting**: `orderBy=field direction` — defaults to `timestamp desc`","produces":["application/json"],"tags":["audit-logs"],"summary":"Get paginated audit log entries for the current organization","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria","name":"filter","in":"query"},{"type":"string","description":"Sort order","name":"orderBy","in":"query"},{"type":"string","description":"Free-text search across user, entity type, action, description, status","name":"search","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 50, max: 100)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_AuditLogDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/locations":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all locations in the system with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `gt` (greater than), `gte` (greater than or equal)\n- `lt` (less than), `lte` (less than or equal)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*Location Fields*:\n- `id` (string): eq, neq\n- `createdBy` (string): eq, neq\n- `modifiedBy` (string): eq, neq\n- `deletedBy` (string): eq, neq\n- `currentVersionId` (string): eq, neq\n- `lastApprovedVersionId` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `updatedAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `deletedAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n*User Fields*:\n- `createdByName` (string): eq, neq, like\n- `createdByEmail` (string): eq, neq, like\n\n*Version Fields*:\n- `parentId` (string): eq, neq\n- `versionNumber` (string): eq, neq, like\n\n*Translation Fields*:\n- `name` (string): eq, neq, like\n- `description` (string): eq, neq, like\n- `languageId` (string): eq, neq\n\n*Language Fields*:\n- `languageName` (string): eq, neq, like\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction` (direction: asc/desc)\n- All filterable fields above are also sortable\n- Example: `orderBy=createdAt desc,name asc`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries in each item.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- When included, each item's `assignments` field is populated with summaries grouped by relation type, then by entity type.\n- Example: `includes=owner,assigned`\n\n**Examples**:\n- Filter by name: `filter=name like America`\n- Filter by language: `filter=languageName eq English`\n- Date range: `filter=createdAt gte 2024-01-01T00:00:00Z&filter=createdAt lt 2024-02-01T00:00:00Z`\n- With includes: `includes=owner,assigned&page=1&size=20`\n- Combined: `filter=languageId eq abc123&filter=name like test&includes=owner&orderBy=createdAt desc&page=1&size=20`","produces":["application/json"],"tags":["locations"],"summary":"Get all locations with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria (format: 'field operator value'). Can be specified multiple times.","name":"filter","in":"query"},{"type":"string","description":"Sort order (format: 'field direction' or 'field1 dir1,field2 dir2')","name":"orderBy","in":"query"},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_LocationDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Create a new location (Shape: physical site, region, building, etc.). Returns the persisted record at version 1.\n\n**Required fields**: `name`, `languageId`.\n\n**`languageId`** — UUID of a Language record; defines the language of the `name`/`description` translation.\n\n**`parentId`** — optional UUID of an existing location to nest under. Omit or send `null` for a root-level location. Cycles are rejected.\n\n**`internalId`** — optional human-friendly identifier (e.g. `LOC-DE-BLN-01`). Unique within the org.\n\n**`links`** — array of `{ \"title\": \"...\", \"url\": \"https://...\" }`. `url` must be absolute http(s).\n\n**`assignments`** — uses the FLAT ARRAY shape (Shape B). Each entry: `{\"relationType\": \"...\", \"targetType\": \"...\", \"targetContainerId\": \"...\"}`. Valid relations for a location source: `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed` (targets: user, organization_profile); `assigned` (bidirectional — targets: process, resource, requirement).\n\nExample body:\n\n```json\n{\n\"name\": \"Berlin HQ\",\n\"description\": \"Main office, Friedrichstraße\",\n\"languageId\": \"b5e0a1f4-9c0c-4f0f-9aa0-7c1a8b6f4d22\",\n\"parentId\": null,\n\"internalId\": \"LOC-DE-BLN-01\",\n\"assignments\": [\n{\"relationType\": \"owner\",    \"targetType\": \"user\",     \"targetContainerId\": \"user_2abc...\"},\n{\"relationType\": \"assigned\", \"targetType\": \"resource\", \"targetContainerId\": \"9b9a...\"}\n]\n}\n```","consumes":["application/json"],"produces":["application/json"],"tags":["locations"],"summary":"Add a new location","parameters":[{"description":"Location data","name":"location","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.AddLocationRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.LocationDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/locations/bulk-delete":{"post":{"security":[{"BearerAuth":[]}],"description":"Soft-delete multiple locations in one transactional call. Body: `{ \"ids\": [\"<uuid>\", ...] }` (1 ≤ ids ≤ 100). If any id is invalid or not found, the whole call is rejected — no partial deletes. Children are not cascaded.","consumes":["application/json"],"tags":["locations"],"summary":"Bulk delete locations","parameters":[{"description":"IDs of locations to delete","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.BulkDeleteLocationRequest"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid request body or IDs","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"One or more locations not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/locations/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a specific location by its unique identifier\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- Example: `includes=owner,assigned`","produces":["application/json"],"tags":["locations"],"summary":"Get a single location by ID","parameters":[{"type":"string","description":"Location ID (UUID)","name":"id","in":"path","required":true},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"}],"responses":{"200":{"description":"Successfully retrieved the location","schema":{"$ref":"#/definitions/dtos.LocationDto"}},"400":{"description":"Invalid location ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Location not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"put":{"security":[{"BearerAuth":[]}],"description":"Update an existing location by creating a new version. The previous version is preserved for history.\n\n**Identifier in path**: `{id}` is the location container UUID (stable across versions).\n\n**All body fields are optional**; omit a field to keep the current value. `internalId` accepts `null` to clear.\n\n**`links`** — when present, the array **replaces** the entire links list; pass `[]` to clear.\n\n**`assignments`** — FLAT ARRAY (Shape B). When present, the array **replaces** the entire assignment set for this location. Omit the field to preserve current assignments. Use `PATCH /locations/{id}/parent` if you only want to reparent.\n\nSupports `If-Match: <etag>` for optimistic concurrency (412 on stale).","consumes":["application/json"],"produces":["application/json"],"tags":["locations"],"summary":"Update a location","parameters":[{"type":"string","description":"Location container ID","name":"id","in":"path","required":true},{"description":"Location data","name":"location","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateLocationRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.LocationDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"delete":{"security":[{"BearerAuth":[]}],"description":"Soft-delete a location by its container UUID. The record is hidden from list/detail endpoints but row history is preserved for audit. Children are not cascaded — reparent them first or remove them explicitly. Idempotent: re-deleting returns `404` (`location.not_found`).","tags":["locations"],"summary":"Delete a location","parameters":[{"type":"string","description":"Location ID","name":"id","in":"path","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/locations/{id}/parent":{"patch":{"security":[{"BearerAuth":[]}],"description":"Reparent a location within the hierarchy without creating a new version.\n\nBody: `{ \"parentId\": \"<uuid>\" | null }`. `null` makes the location a root; a UUID moves it under an existing location. Self-references and cycles are rejected (`400 location.parent_cycle`). The parent must exist in the same organization.","consumes":["application/json"],"produces":["application/json"],"tags":["locations"],"summary":"Update location parent","parameters":[{"type":"string","description":"Location ID (UUID format)","name":"id","in":"path","required":true},{"description":"Parent update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateLocationParentRequest"}}],"responses":{"200":{"description":"Successfully updated location parent","schema":{"$ref":"#/definitions/dtos.LocationDto"}},"400":{"description":"Invalid request body, circular reference, or self-reference","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Location or parent not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all organization profiles in the system with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `gt` (greater than), `gte` (greater than or equal)\n- `lt` (less than), `lte` (less than or equal)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*Organization Profile Fields*:\n- `id` (string): eq, neq\n- `createdBy` (string): eq, neq\n- `modifiedBy` (string): eq, neq\n- `deletedBy` (string): eq, neq\n- `entityType` (string): eq, neq\n- `currentVersionId` (string): eq, neq\n- `lastApprovedVersionId` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `updatedAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `deletedAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n*User Fields*:\n- `createdName` (string): eq, neq, like\n- `createdEmail` (string): eq, neq, like\n\n*Version Fields*:\n- `status` (string): eq, neq\n- `parentId` (string): eq, neq\n- `versionNumber` (string): eq, neq, like\n\n*Translation Fields*:\n- `name` (string): eq, neq, like\n- `description` (string): eq, neq, like\n- `languageId` (string): eq, neq\n\n*Language Fields*:\n- `languageName` (string): eq, neq, like\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction` (direction: asc/desc)\n- All filterable fields above are also sortable\n- Example: `orderBy=createdAt desc,name asc`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Exclude IDs**: Use the `excludeIds` query parameter to exclude specific records by ID.\n- Format: `excludeIds=uuid1,uuid2`\n- Useful for preventing self-references in dropdowns (e.g., excluding the entity being edited).\n- Example: `excludeIds=550e8400-e29b-41d4-a716-446655440000`\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries in each item.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- When included, each item's `assignments` field is populated with summaries grouped by relation type, then by entity type.\n- Example: `includes=owner,assigned`\n\n**Examples**:\n- Filter by name: `filter=name like Acme`\n- Filter by status: `filter=status eq APPROVED`\n- Date range: `filter=createdAt gte 2024-01-01T00:00:00Z&filter=createdAt lt 2024-02-01T00:00:00Z`\n- With includes: `includes=owner,assigned&page=1&size=20`\n- Combined: `filter=status eq APPROVED&filter=name like test&includes=owner&orderBy=createdAt desc&page=1&size=20`","produces":["application/json"],"tags":["organization-profiles"],"summary":"Get all organization profiles with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria (format: 'field operator value'). Can be specified multiple times.","name":"filter","in":"query"},{"type":"string","description":"Comma-separated list of IDs to exclude from results (e.g., to prevent self-references in dropdowns)","name":"excludeIds","in":"query"},{"type":"string","description":"Sort order (format: 'field direction' or 'field1 dir1,field2 dir2')","name":"orderBy","in":"query"},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_OrganizationProfileDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Create a new organization profile node. Used for departments, roles, staff positions, external partners, and working groups — all live in the org-chart tree.\n\n**Required**: `entityType`, `name`, `languageId`.\n\n**`entityType`** — one of:\n- `department` — internal department\n- `role` — abstract role (e.g. \"QA Engineer\")\n- `staff_position` — assignable position that can carry a user\n- `external_partner` — third-party org; populates contact fields\n- `working_group` — cross-functional group\n(the `org_chart` root is system-managed; do not create it via this endpoint)\n\n**`parentId`** — UUID of an existing profile (typically the org_chart root or a department). Omit or `null` for a root.\n\n**`abbreviation`** — optional short code shown in tree views (e.g. \"HR\").\n\n**`internalId`** — optional unique identifier within the org.\n\n**External-partner contact fields** (`contactName`, `contactEmail`, `contactPhone`, `contactAddress`, `contactPostalCode`, `contactCity`, `contactCountry`) — only honored when `entityType == \"external_partner\"`. Ignored for other entity types.\n\n**`assignments`** — NESTED MAP (Shape A): `{ relationType: { entityTypePlural: [ {targetContainerId, contextContainerId?} ] } }`. Valid relations for an organization_profile source: `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed` (targets: user, organization_profile); `happensIn` (target: location); `assigned` (bidirectional — targets: resource, organization_profile); `member` (targets: user, organization_profile); `contributing` (target: organization_profile).\n\nExample body (a new department with two members and an owner):\n\n```json\n{\n\"entityType\": \"department\",\n\"name\": \"Customer Success\",\n\"abbreviation\": \"CS\",\n\"languageId\": \"b5e0a1f4-...\",\n\"parentId\": \"<org_chart-uuid>\",\n\"assignments\": {\n\"owner\":  {\"users\": [{\"targetContainerId\": \"user_2abc...\"}]},\n\"member\": {\"users\": [{\"targetContainerId\": \"user_def...\"}, {\"targetContainerId\": \"user_ghi...\"}]}\n}\n}\n```","consumes":["application/json"],"produces":["application/json"],"tags":["organization-profiles"],"summary":"Add a new organization profile","parameters":[{"description":"Organization Profile data","name":"organizationProfile","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.AddOrganizationProfileRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.OrganizationProfileDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles/bulk-delete":{"post":{"security":[{"BearerAuth":[]}],"description":"Soft-delete multiple organization profiles in one transactional call. Body: `{ \"ids\": [\"<uuid>\", ...] }` (1 ≤ ids ≤ 100). The whole call is rejected if any id is invalid, not found, or refers to the system `org_chart` root. Children are not cascaded — list them in the same call to remove a subtree.","consumes":["application/json"],"tags":["organization-profiles"],"summary":"Bulk delete organization profiles","parameters":[{"description":"IDs of organization profiles to delete","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.BulkDeleteOrganizationProfileRequest"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid request body or IDs","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"One or more organization profiles not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a specific organization profile by its unique identifier\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries.\n- Format: `includes=relationType1,relationType2`\n- Allowed relation types (forward): `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- Allowed reverse-direction keys: `linkedProcesses`, `linkedRequirements`, `linkedResources`, `linkedLocations`\n- Example: `includes=owner,linkedProcesses`","produces":["application/json"],"tags":["organization-profiles"],"summary":"Get a single organization profile by ID","parameters":[{"type":"string","description":"Organization Profile ID (UUID format)","name":"id","in":"path","required":true},{"type":"string","description":"Comma-separated list of relation types and/or reverse-direction keys (e.g., owner, linkedProcesses)","name":"includes","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.OrganizationProfileDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"put":{"security":[{"BearerAuth":[]}],"description":"Update an organization profile by creating a new version. Partial-update with merge semantics — fields and assignment keys not in the body are preserved from the current version.\n\n**Path `{id}`** is the profile container UUID. `entityType` cannot be changed after creation.\n\n**`assignments`** uses the NESTED MAP (Shape A) with two-level merge:\n- Outer relation key absent → preserve that relation entirely.\n- Relation present with `{}` → clear that relation across all entity types.\n- Inner entity-type key absent within a present relation → preserve that entity type.\n- Inner entity-type key present with `[]` → clear only that entity type, others preserved.\n- Inner entity-type key present with entries → replace that entity type's set.\n\n**External-partner contact fields** are pointers — `null` clears, omitted preserves. Only meaningful when the profile is `external_partner`; ignored otherwise.\n\nUse `PATCH /organization-profiles/{id}/parent` to reparent only. Supports `If-Match` for optimistic concurrency.","consumes":["application/json"],"produces":["application/json"],"tags":["organization-profiles"],"summary":"Update an organization profile","parameters":[{"type":"string","description":"Organization profile container ID","name":"id","in":"path","required":true},{"description":"Organization profile partial update","name":"organizationProfile","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateOrganizationProfileRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.OrganizationProfileDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"delete":{"security":[{"BearerAuth":[]}],"description":"Soft-delete an organization profile by its container UUID. Hidden from list/detail; history preserved for audit. Children (sub-departments/roles) are not cascaded — reparent them first or use bulk delete. Cannot delete the system `org_chart` root. Re-deleting returns `404` (`organization_profile.not_found`).","tags":["organization-profiles"],"summary":"Delete an organization profile","parameters":[{"type":"string","description":"Organization Profile ID (UUID format)","name":"id","in":"path","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles/{id}/org-chart-model":{"get":{"security":[{"BearerAuth":[]}],"description":"Return the latest org-chart layout for the children of the given organization profile. Each node's `businessData` is **re-hydrated from the current profile state**, so renamed/moved profiles show their current name/entityType even if the layout was saved earlier.\n\nReturns `404` if no layout has been saved for this profile — the frontend then falls back to an auto-generated row layout. Response shape matches the POST payload (`{ \"nodes\": [...], \"edges\": [...], \"ports\": [...], \"bends\": [...] }`) wrapped in the OrgChartModelDto envelope.","produces":["application/json"],"tags":["org_chart"],"summary":"Get an org chart model","parameters":[{"type":"string","description":"Organization Profile ID","name":"id","in":"path","required":true}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.OrgChartModelDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Persist an org-chart diagram (positions of departments/roles/etc. that are direct children of the given organization profile). Creates a **new version**; the previous version is preserved.\n\n**Path `{id}`** — the parent organization profile UUID. The org-chart layout describes only the *direct children* of this profile; nested layouts are saved per profile (each department has its own chart).\n\n**Payload shape** — `{ \"nodes\": [...], \"edges\": [...], \"ports\": [...], \"bends\": [...] }`. Empty payloads (leaf profile with no children) are valid.\n\nNode fields:\n- `hashCode` (int) — locally unique node ID.\n- `entityType` — one of `department`, `role`, `staff_position`, `external_partner`, `working_group` (not `org_chart`).\n- `parentHashCode` (int|null) — for nested layouts inside the same chart; usually `null`.\n- `x`, `y`, `width`, `height` — canvas geometry (px). Seed-data uses 160×70.\n- `textContent` — display label.\n- `businessData.id` — the org-profile container UUID the node represents (links the shape back to a real profile).\n- `businessData.entityType`, `businessData.name`, `businessData.description` — denormalized profile data for fast rendering.\n\n`edges`, `ports`, `bends` use the same hashCode-linking pattern as BPMN. For a simple \"row of cards\" layout, edges/ports/bends are empty.\n\nComplete example payload — a row of three direct-child profiles laid out horizontally with no edges:\n\n```json\n{\n\"nodes\": [\n{\n\"hashCode\": 1,\n\"entityType\": \"department\",\n\"parentHashCode\": null,\n\"x\": 600, \"y\": 300, \"width\": 160, \"height\": 70,\n\"textContent\": \"Engineering\",\n\"businessData\": {\n\"id\": \"9b9a1c20-7e3a-4d2f-8e1b-2b3c4d5e6f70\",\n\"entityType\": \"department\",\n\"name\": \"Engineering\",\n\"description\": \"Builds and operates the product\"\n}\n},\n{\n\"hashCode\": 2,\n\"entityType\": \"department\",\n\"parentHashCode\": null,\n\"x\": 800, \"y\": 300, \"width\": 160, \"height\": 70,\n\"textContent\": \"Sales\",\n\"businessData\": {\n\"id\": \"0e1f2a34-5b6c-7d8e-9f0a-1b2c3d4e5f60\",\n\"entityType\": \"department\",\n\"name\": \"Sales\",\n\"description\": \"Owns revenue and pipeline\"\n}\n},\n{\n\"hashCode\": 3,\n\"entityType\": \"working_group\",\n\"parentHashCode\": null,\n\"x\": 1000, \"y\": 300, \"width\": 160, \"height\": 70,\n\"textContent\": \"Compliance WG\",\n\"businessData\": {\n\"id\": \"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d\",\n\"entityType\": \"working_group\",\n\"name\": \"Compliance WG\",\n\"description\": \"Cross-functional compliance group\"\n}\n}\n],\n\"edges\": [],\n\"ports\": [],\n\"bends\": []\n}\n```","consumes":["application/json"],"produces":["application/json"],"tags":["org_chart"],"summary":"Save a new org chart model","parameters":[{"type":"string","description":"Organization Profile ID","name":"id","in":"path","required":true},{"description":"Org chart payload JSON","name":"body","in":"body","required":true,"schema":{"type":"object"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.OrgChartModelDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles/{id}/parent":{"patch":{"security":[{"BearerAuth":[]}],"description":"Reparent an organization profile within the org-chart tree without creating a new version.\n\nBody: `{ \"parentId\": \"<uuid>\" | null }`. `null` reparents to the system-managed org_chart root. Most profiles should be re-rooted under the org_chart root rather than left with `null` — passing `null` is treated equivalently to \"under the org_chart root\" by the frontend. Self-references and cycles rejected (`400 organization_profile.parent_cycle`).","consumes":["application/json"],"produces":["application/json"],"tags":["organization-profiles"],"summary":"Update organization profile parent","parameters":[{"type":"string","description":"Organization profile ID (UUID format)","name":"id","in":"path","required":true},{"description":"Parent update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateOrganizationProfileParentRequest"}}],"responses":{"200":{"description":"Successfully updated organization profile parent","schema":{"$ref":"#/definitions/dtos.OrganizationProfileDto"}},"400":{"description":"Invalid request body, circular reference, or self-reference","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Organization profile or parent not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles/{id}/pin":{"put":{"security":[{"BearerAuth":[]}],"description":"Pin or unpin an organization profile from the dashboard tile view.\n\nBody: `{ \"pin\": true | false }` (required). `true` pins the profile and auto-assigns the next available order index; `false` unpins it (and any other pinned profiles' orders compact automatically).\n\nRequires `Manager` role or higher (or PAT scope `organization_profile:write`). Returns the updated profile DTO with the new `pinnedOrder` field.","consumes":["application/json"],"produces":["application/json"],"tags":["organization-profiles"],"summary":"Set pinned order of an organization profile","parameters":[{"type":"string","description":"Organization profile ID (UUID format)","name":"id","in":"path","required":true},{"description":"Pin request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.SetPinnedOrderRequest"}}],"responses":{"200":{"description":"Successfully set pinned order","schema":{"$ref":"#/definitions/dtos.OrganizationProfileDto"}},"400":{"description":"Invalid request body","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"403":{"description":"Forbidden - insufficient role","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Organization profile not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organization-profiles/{id}/tree":{"get":{"security":[{"BearerAuth":[]}],"description":"Returns the descendants of the requested organization profile down to the requested depth.\nThe requested profile itself is never included.\n\nThe response is a flat array of slim `OrganizationProfileTreeDto` items — only the\nfields needed for graph bootstrap (identity, parent reference, display fields,\nassignments). Each item carries its `parentId`, so callers can reassemble whatever\nshape they need (tree, edge list, etc.). \"location\" surfaces under\n`assignments.<relationType>.locations[]`, not as a flat field. Items with no\nassignments omit the `assignments` field.\n\n**Depth semantics**: counts levels of descendants, not the root.\n- `depth=0` → empty array\n- `depth=1` → direct children only\n- `depth=N` → up to N generations of descendants\n- `depth < 0` or `depth > 50` → 400 Bad Request","produces":["application/json"],"tags":["organization-profiles"],"summary":"Get the descendants of an organization profile as a flat list","parameters":[{"type":"string","description":"Organization Profile ID (UUID format)","name":"id","in":"path","required":true},{"type":"integer","description":"Maximum descendant depth (0–50)","name":"depth","in":"query","required":true}],"responses":{"200":{"description":"OK","schema":{"type":"array","items":{"$ref":"#/definitions/dtos.OrganizationProfileTreeDto"}}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organizations":{"post":{"security":[{"BearerAuth":[]}],"description":"Provision a new tenant: creates the Clerk organization (unless `externalOrgExists` is true), creates the dedicated PostgreSQL database, runs migrations, sets up audit partitions, and optionally seeds sample data.\n\nBody fields:\n- `slug` (required, 2..63 chars) — lowercase URL-safe identifier; becomes the tenant DB name and the PAT prefix (`pat_{slug}_...`). Must be globally unique.\n- `name` (required) — human-friendly display name.\n- `withSampleData` (bool, optional) — when true, seeds a demo dataset (processes/resources/locations/etc.) after migration.\n- `externalOrgExists` (bool, optional) — set true if the Clerk org already exists; skips gateway creation and only provisions the DB side.\n\nAny authenticated user can call this (no role required) — there is no org context yet. Returns the created org DTO including its slug.\n\n**PAT access**: Not available — organization provisioning is an out-of-band administrative action that requires a Clerk user. PATs are scoped to one org and cannot create others.","consumes":["application/json"],"produces":["application/json"],"tags":["organizations"],"summary":"Create a new organization","parameters":[{"description":"Organization data","name":"organization","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.CreateOrganizationRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.OrganizationDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organizations/databases/check":{"get":{"security":[{"BearerAuth":[]}],"description":"Admin-only sanity check: given one or more organization slugs as repeated `?slugs=<slug>` query params (max 100), return per-slug existence status of the tenant database. Used during onboarding to detect orphaned Clerk orgs without a backend DB.\n\n**PAT access**: Not available — admin tooling restricted to Clerk users.","produces":["application/json"],"tags":["organizations"],"summary":"Check if databases exist for organization slugs","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Organization slugs to check (max 100)","name":"slugs","in":"query","required":true}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.CheckDatabasesExistenceResult"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organizations/databases/{slug}":{"delete":{"security":[{"BearerAuth":[]}],"description":"**Destructive admin operation**: drops the entire tenant PostgreSQL database for the given slug. All processes, resources, locations, requirements, organization profiles, BPMN/org-chart models, audit history, and PATs in that org are permanently deleted. Existence is checked first; missing slugs return `404`. There is no undo.\n\nAdmin role required. Used during tenant offboarding or cleanup of failed provisioning. The Clerk org itself is **not** affected — remove it via the Clerk dashboard separately.\n\n**PAT access**: Not available — destructive admin tooling restricted to Clerk users.","produces":["application/json"],"tags":["organizations"],"summary":"Delete an organization database","parameters":[{"maxLength":63,"minLength":2,"type":"string","description":"Organization slug","name":"slug","in":"path","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organizations/members/invite":{"post":{"security":[{"BearerAuth":[]}],"description":"Add a user to the active Clerk organization. Two modes (exactly one of `email` or `clerkUserId` must be set):\n- **By email** — `{ \"email\": \"alice@example.com\", \"role\": \"contributor\" }` sends a Clerk invitation email. The user joins on accept.\n- **By Clerk user ID** — `{ \"clerkUserId\": \"user_2abc...\", \"role\": \"manager\" }` adds the user immediately (used when the user already exists in Clerk).\n\n`role` is one of `viewer`, `contributor`, `manager`, `admin`. Requires admin role on the active org.\n\nReturns `409` with `organization.member_already_exists` if the user is already a member or has a pending invitation.\n\n**PAT access**: Not available — member management is restricted to Clerk users so PATs cannot self-elevate access.","consumes":["application/json"],"produces":["application/json"],"tags":["organizations"],"summary":"Invite or add a member to the organization","parameters":[{"description":"Invite member request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.InviteMemberRequest"}}],"responses":{"200":{"description":"Successfully processed invite","schema":{"$ref":"#/definitions/commands.InviteMemberResult"}},"400":{"description":"Invalid request body","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"403":{"description":"Forbidden - admin role required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"User is already a member or has a pending invitation","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/organizations/members/{id}/role":{"patch":{"security":[{"BearerAuth":[]}],"description":"Change an existing member's role in the active Clerk organization. Path `{id}` is the internal user UUID (from `GET /users`); Clerk user IDs (`user_...`) are not accepted here.\n\nBody: `{ \"role\": \"<role>\" }` — one of `viewer`, `contributor`, `manager`, `admin`. Requires admin role; admins cannot demote themselves below admin (`400 organization.cannot_self_demote`).\n\n**PAT access**: Not available — member management is restricted to Clerk users.","consumes":["application/json"],"produces":["application/json"],"tags":["organizations"],"summary":"Update a member's organization role","parameters":[{"type":"string","description":"User ID (UUID format)","name":"id","in":"path","required":true},{"description":"Role update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateMemberRoleRequest"}}],"responses":{"200":{"description":"Successfully updated member role","schema":{"$ref":"#/definitions/commands.UpdateMemberRoleResult"}},"400":{"description":"Invalid request body or user ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"403":{"description":"Forbidden - admin role required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Member not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/process-versions/{processVersionId}/bpmn-model":{"post":{"security":[{"BearerAuth":[]}],"description":"Persist a BPMN diagram payload as a new model attached to the given process version. The whole diagram (nodes, edges, ports, bends) is sent in one POST.\n\n**Path `processVersionId`** is a Process **version** UUID (not the container UUID). Use `GET /processes/{id}` to get the active version.\n\n**Payload shape** — top level: `{ \"state\": \"unlocked\"|\"locked\"|\"in_editing\"|\"approved\", \"editors\": [\"user_...\"], \"nodes\": [...], \"edges\": [...], \"ports\": [...], \"bends\": [...] }`.\n\nNode fields (each node):\n- `hashCode` (int) — locally unique node identifier; used by edges/ports to reference it.\n- `entityType` — `task`, `subprocess`, `document`, `exclusive`, `inclusive`, `intermediate`, `parallel`, `start`, `message`, `end`, `timer`, `pool`, `lane`, `picture`, `annotation`.\n- `parentHashCode` (int|null) — for nested pools/lanes.\n- `x`, `y`, `width`, `height` (number) — canvas geometry (px).\n- `strokeColor`, `backgroundColor`, `textContent`, `imageUrl` — optional styling.\n- `businessData.name` — node label as **HTML** (ProseMirror output, e.g. `\"<p>Validate order</p>\"`).\n- `businessData.description` — optional rich description.\n- `businessData.assignments` — BPMN nodes use a simplified ID-only shape: `{ relationType: { entityTypePlural: [\"<uuid>\", \"<uuid>\"] } }`. Only the `involved` relation is allowed for resources/requirements; `owner`/`responsible`/etc. accept user and organization_profile IDs.\n\nEdges connect nodes via their ports: each edge requires `sourceNodeHashCode`, `targetNodeHashCode`, `sourcePortHashCode`, `targetPortHashCode` (all referencing hashCodes that exist in the payload). Optional `edgeType` is `sequence_flow` (default) or `message_flow`.\n\nPorts anchor edges on nodes (`hashCode`, `nodeHashCode`, `x`, `y`). Bends add waypoints to an edge (`edgeHashCode`, `x`, `y`).\n\nComplete example payload — a minimal start → task → end flow with one cross-domain assignment on the task:\n\n```json\n{\n\"state\": \"unlocked\",\n\"editors\": [],\n\"nodes\": [\n{\n\"hashCode\": 1,\n\"entityType\": \"start\",\n\"parentHashCode\": null,\n\"x\": 740, \"y\": 377.5, \"width\": 80, \"height\": 80,\n\"strokeColor\": \"#079455\", \"backgroundColor\": \"#ffffff\",\n\"businessData\": { \"name\": \"<p>Start</p>\" }\n},\n{\n\"hashCode\": 2,\n\"entityType\": \"task\",\n\"parentHashCode\": null,\n\"x\": 945, \"y\": 377.5, \"width\": 160, \"height\": 80,\n\"strokeColor\": \"#18181b\", \"backgroundColor\": \"#ffffff\",\n\"businessData\": {\n\"name\": \"<p>Validate order</p>\",\n\"assignments\": {\n\"involved\": {\n\"resources\":    [\"9b9a1c20-7e3a-4d2f-8e1b-2b3c4d5e6f70\"],\n\"requirements\": [\"0e1f2a34-5b6c-7d8e-9f0a-1b2c3d4e5f60\"]\n}\n}\n}\n},\n{\n\"hashCode\": 3,\n\"entityType\": \"end\",\n\"parentHashCode\": null,\n\"x\": 1230, \"y\": 377.5, \"width\": 80, \"height\": 80,\n\"strokeColor\": \"#d92d20\", \"backgroundColor\": \"#ffffff\",\n\"businessData\": { \"name\": \"<p>End</p>\" }\n}\n],\n\"ports\": [\n{ \"hashCode\": 10, \"nodeHashCode\": 1, \"x\": 780, \"y\": 417.5 },\n{ \"hashCode\": 11, \"nodeHashCode\": 2, \"x\": 1025, \"y\": 417.5 },\n{ \"hashCode\": 12, \"nodeHashCode\": 2, \"x\": 1025, \"y\": 417.5 },\n{ \"hashCode\": 13, \"nodeHashCode\": 3, \"x\": 1270, \"y\": 417.5 }\n],\n\"edges\": [\n{\n\"hashCode\": 20,\n\"edgeType\": \"sequence_flow\",\n\"sourceNodeHashCode\": 1, \"targetNodeHashCode\": 2,\n\"sourcePortHashCode\": 10, \"targetPortHashCode\": 11\n},\n{\n\"hashCode\": 21,\n\"edgeType\": \"sequence_flow\",\n\"sourceNodeHashCode\": 2, \"targetNodeHashCode\": 3,\n\"sourcePortHashCode\": 12, \"targetPortHashCode\": 13\n}\n],\n\"bends\": []\n}\n```\n\nThe response echoes the payload along with `modelId` and `newVersionId`.","consumes":["application/json"],"produces":["application/json"],"tags":["bpmn"],"summary":"Create a new BPMN model","parameters":[{"type":"string","description":"Process version ID","name":"processVersionId","in":"path","required":true}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.CreateBpmnModelResponse"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/process-versions/{processversionid}/bpmn-model":{"get":{"security":[{"BearerAuth":[]}],"description":"Return the latest BPMN diagram payload (nodes/edges/ports/bends) attached to the given process **version** UUID. Returns `404` if no BPMN model exists for that version yet — call `POST /process-versions/{processversionid}/bpmn-model` to create one.\n\nThe response payload schema mirrors the POST request shape, with two differences: (1) `businessData.assignments` is **enriched** — each entry is `{ id, name, entityType? }` (an `AssignmentSummary`), not just an ID; (2) the top-level response wraps the payload as `{ \"modelId\": \"...\", \"jsonPayload\": { ...same shape as POST... } }`.","produces":["application/json"],"tags":["bpmn"],"summary":"Get BPMN model payload by process version","parameters":[{"type":"string","description":"Process Version ID (UUID)","name":"processversionid","in":"path","required":true}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.BpmnModelPayloadDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/processes":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all processes in the system with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `gt` (greater than), `gte` (greater than or equal)\n- `lt` (less than), `lte` (less than or equal)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*Process Fields*:\n- `id` (string): eq, neq\n- `entityType` (string): eq, neq\n- `parentId` (string): eq, neq\n- `createdBy` (string): eq, neq\n- `modifiedBy` (string): eq, neq\n- `deletedBy` (string): eq, neq\n- `currentVersionId` (string): eq, neq\n- `lastApprovedVersionId` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `modifiedAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `deletedAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n*User Fields*:\n- `createdName` (string): eq, neq, like\n- `createdEmail` (string): eq, neq, like\n\n*Version Fields*:\n- `versionNumber` (string): eq, neq, like\n- `versionStatus` (string): eq, neq\n\n*Translation Fields*:\n- `name` (string): eq, neq, like\n- `description` (string): eq, neq, like\n- `languageId` (string): eq, neq\n- `languageName` (string): eq, neq, like\n\n**Search**: Use the `search` query parameter for free-text search across multiple fields.\n- Searches across: name, versionNumber, versionStatus, modifiedBy, languageName\n- Also searches related entities: owner (user name), participants (responsible/accountable/consulted/informed user names), location (location name)\n- Multiple words are ANDed: `search=müller draft` matches items containing both \"müller\" AND \"draft\"\n- Case-insensitive and diacritic-insensitive (e.g., \"muller\" matches \"Müller\")\n- Use `searchExclude` to exclude specific search scopes (comma-separated keys: name, versionNumber, versionStatus, modifiedBy, languageName, owner, participants, location)\n- Example: `search=müller&searchExclude=owner,participants` (searches only column fields, not relations)\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction` (direction: asc/desc)\n- All filterable fields above are also sortable\n- Example: `orderBy=createdAt desc,processName asc`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries in each item.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `location`, `assigned`\n- When included, each item's `assignments` field is populated with summaries grouped by relation type, then by entity type.\n- Example: `includes=owner,assigned`\n\n**Examples**:\n- Filter by name: `filter=name like automation`\n- Filter by status: `filter=versionStatus eq approved`\n- Date range: `filter=createdAt gte 2024-01-01T00:00:00Z&filter=createdAt lt 2024-02-01T00:00:00Z`\n- With includes: `includes=owner,assigned&page=1&size=20`\n- Combined: `filter=versionStatus eq approved&includes=owner&orderBy=createdAt desc&page=1&size=20`","produces":["application/json"],"tags":["processes"],"summary":"Get all processes with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria (format: 'field operator value'). Can be specified multiple times.","name":"filter","in":"query"},{"type":"string","description":"Free-text search across name, version, status, modifiedBy, language, owner, participants, and location","name":"search","in":"query"},{"type":"string","description":"Comma-separated keys to exclude from search (e.g., 'owner,participants'). Keys: name, versionNumber, versionStatus, modifiedBy, languageName, owner, participants, location","name":"searchExclude","in":"query"},{"type":"string","description":"Sort order (format: 'field direction' or 'field1 dir1,field2 dir2')","name":"orderBy","in":"query"},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_ProcessDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Create a new process (or process group) in the active organization. Returns the persisted process with `id`, `versionNumber: \"1\"`, `versionStatus: \"new\"`, and any assignments expanded into the read shape.\n\n**Required fields**: `entityType`, `name`, `languageId`.\n\n**`entityType`** discriminator — one of:\n- `process` — a leaf process. May have `process` or `process_group` parent.\n- `process_group` — a folder/container that groups child processes or groups. Same payload shape as `process`.\n\n**`languageId`** — UUID of a Language record (see `GET /languages`). Defines the language of the `name`/`description`/`objective`/`targetAudience` translation.\n\n**`parentId`** — UUID of an existing process or `null`/omitted for a root-level process. Must reference a `process_group` (or another `process` when nesting is allowed); validation rejects mismatches.\n\n**`internalId`** — optional human-friendly identifier (e.g. `PROC-001`). Unique within the org; pass empty string to skip.\n\n**`links`** — array of `{ \"title\": \"...\", \"url\": \"https://...\", \"order\": 0 }`. `url` must be absolute http(s).\n\n**`assignments`** — nested map `{ relationType: { entityTypePlural: [ { \"targetContainerId\": \"...\", \"contextContainerId\"?: \"...\" } ] } }`. See the top-level \"Assignments — request payload shape\" guide for the full schema and valid relation→target combinations.\n\nExample body:\n\n```json\n{\n\"entityType\": \"process\",\n\"name\": \"Customer onboarding\",\n\"description\": \"End-to-end onboarding flow for new B2B customers\",\n\"objective\": \"Reduce time-to-first-value to under 7 days\",\n\"processMaturity\": \"defined\",\n\"targetAudience\": \"Sales + Customer Success\",\n\"languageId\": \"b5e0a1f4-9c0c-4f0f-9aa0-7c1a8b6f4d22\",\n\"parentId\": null,\n\"internalId\": \"PROC-014\",\n\"links\": [{\"title\": \"Playbook\", \"url\": \"https://wiki.example.com/onboarding\"}],\n\"assignments\": {\n\"owner\":    {\"users\": [{\"targetContainerId\": \"user_2abc...\"}]},\n\"assigned\": {\"resources\": [{\"targetContainerId\": \"9b9a-...\"}]}\n}\n}\n```\n\nCommon errors: `process.name.required` (400), `process.languageId.invalid` (400), `assignment.invalid_relation_type` (400), `assignment.invalid_combination` (400), `process.parent_not_found` (404), `process.already_exists` (409).","consumes":["application/json"],"produces":["application/json"],"tags":["processes"],"summary":"Add a new process","parameters":[{"description":"Process data","name":"process","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.AddProcessRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.ProcessDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/processes/bulk-delete":{"post":{"security":[{"BearerAuth":[]}],"description":"Soft-delete multiple processes in one call. Body: `{ \"ids\": [\"<uuid>\", \"<uuid>\", ...] }`. Limits: 1 ≤ ids ≤ 100. The operation is best-effort per-id; an unknown id returns `404` for the whole call without partial commits.\n\nRequires `Manager` role (or PAT scope `process:write`). Like single delete, child processes are not cascaded.","consumes":["application/json"],"tags":["processes"],"summary":"Bulk delete processes","parameters":[{"description":"List of process IDs to delete","name":"request","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.BulkDeleteProcessRequest"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/processes/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a specific process by its unique identifier.\n\n**Includes** — embed process-level assignment summaries via the `includes` query parameter.\n- Format: `includes=relationType1,relationType2`\n- Dot notation for entity-type filtering: `includes=assigned.resources` returns only resources under assigned.\n- Allowed relation types: `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed`, `happensIn`, `participant`, `assigned`\n- Example: `includes=owner,assigned.resources`\n\n**BpmnIncludes** — embed BPMN-node-level assignment summaries via the `bpmnIncludes` query parameter.\n- When absent, `bpmnAssignments` is not returned.\n- Format: `bpmnIncludes=relationType1,relationType2`\n- Dot notation supported: `bpmnIncludes=involved.resources`\n- Allowed relation types: `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed`, `happensIn`, `involved`\n- Example: `bpmnIncludes=responsible,involved.resources`","produces":["application/json"],"tags":["processes"],"summary":"Get a single process by ID","parameters":[{"type":"string","description":"Process ID (UUID format)","name":"id","in":"path","required":true},{"type":"string","description":"Comma-separated relation types for process-level assignments (supports dot notation, e.g. assigned.resources)","name":"includes","in":"query"},{"type":"string","description":"Comma-separated relation types for BPMN-node-level assignments (supports dot notation, e.g. involved.resources)","name":"bpmnIncludes","in":"query"}],"responses":{"200":{"description":"Successfully retrieved the process","schema":{"$ref":"#/definitions/dtos.ProcessDto"}},"400":{"description":"Invalid process ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Process not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"put":{"security":[{"BearerAuth":[]}],"description":"Update an existing process by creating a **new version** of it. The previous version is preserved for history; the response returns the new version (`versionStatus: \"new\"`, incremented `versionNumber`).\n\n**All body fields are optional** — omit a field to keep the current value. This is a partial update, not a full replace.\n\n**Identifier in path**: `{id}` is the process **container** UUID returned by GET (the same value across versions). Do not pass a version ID.\n\n**Field semantics**:\n- `name`, `description`, `objective`, `processMaturity`, `targetAudience`, `languageId` — write a new translation. `languageId` switches the editable translation language.\n- `parentId` — pass a UUID to reparent, `null` to make this process a root, omit to preserve the current parent. Use the dedicated `PATCH /processes/{id}/parent` if you only need to reparent.\n- `internalId` — pass `null` to clear, a string to set, omit to preserve.\n- `links` — when present, the array **replaces** the entire links list; pass `[]` to clear.\n- `assignments` — nested merge (see \"Assignments — request payload shape\" at the top of this spec):\n- omit a relation key → preserve all entries of that relation.\n- `\"relation\": {}` → clear that relation across all entity types.\n- omit an entity-type key inside a present relation → preserve that entity type.\n- `\"relation\": {\"users\": []}` → clear users for that relation, leave other entity types untouched.\n- `\"relation\": {\"users\": [{...}, ...]}` → replace users for that relation with the listed entries.\n\n**Concurrency**: optionally send `If-Match: <etag>` (from the prior GET) to enable optimistic locking; mismatches return `412 Precondition Failed`.\n\nExample body (rename + add an owner + clear consulted):\n\n```json\n{\n\"name\": \"Customer onboarding v2\",\n\"assignments\": {\n\"owner\":     {\"users\": [{\"targetContainerId\": \"user_2abc...\"}]},\n\"consulted\": {}\n}\n}\n```\n\nCommon errors: `process.not_found` (404), `process.invalid_parent` (400), `assignment.invalid_combination` (400), `process.precondition_failed` (412).","consumes":["application/json"],"produces":["application/json"],"tags":["processes"],"summary":"Update a process","parameters":[{"type":"string","description":"Process container ID","name":"id","in":"path","required":true},{"description":"Process data","name":"process","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateProcessRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.ProcessDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"delete":{"security":[{"BearerAuth":[]}],"description":"Soft-delete a process by its container UUID. The record is hidden from list/detail endpoints but row history is preserved for audit. Idempotent: deleting an already-deleted process returns `404` with code `process.not_found`.\n\nChildren (sub-processes) are **not** cascaded — reparent them first or use bulk delete with explicit IDs.","tags":["processes"],"summary":"Delete a process","parameters":[{"type":"string","description":"Process ID","name":"id","in":"path","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/processes/{id}/parent":{"patch":{"security":[{"BearerAuth":[]}],"description":"Reparent a process within the hierarchy tree **without** creating a new version (use this instead of PUT when you only want to move a node).\n\nBody: `{ \"parentId\": \"<uuid>\" | null }`. Pass `null` to make the process a root-level node; pass an existing process UUID to move it under that parent.\n\n**Validation**:\n- The target parent must exist in the same organization and must be a `process` or `process_group` (you cannot parent under a different domain).\n- Self-references and cycles are rejected with `400` / `process.parent_cycle`.\n- Reparenting a `process_group` carries its subtree.","consumes":["application/json"],"produces":["application/json"],"tags":["processes"],"summary":"Update process parent","parameters":[{"type":"string","description":"Process ID (UUID format)","name":"id","in":"path","required":true},{"description":"Parent update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateProcessParentRequest"}}],"responses":{"200":{"description":"Successfully updated process parent","schema":{"$ref":"#/definitions/dtos.ProcessDto"}},"400":{"description":"Invalid request body, circular reference, or self-reference","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Process or parent not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/requirements":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all requirements in the system with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `gt` (greater than), `gte` (greater than or equal)\n- `lt` (less than), `lte` (less than or equal)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*Requirement Fields*:\n- `id` (string): eq, neq\n- `createdBy` (string): eq, neq\n- `modifiedBy` (string): eq, neq\n- `deletedBy` (string): eq, neq\n- `currentVersionId` (string): eq, neq\n- `lastApprovedVersionId` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `updatedAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `deletedAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n*User Fields*:\n- `createdName` (string): eq, neq, like\n- `createdEmail` (string): eq, neq, like\n\n*Translation Fields*:\n- `name` (string): eq, neq, like\n- `description` (string): eq, neq, like\n- `languageId` (string): eq, neq\n- `languageName` (string): eq, neq, like\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction` (direction: asc/desc)\n- All filterable fields above are also sortable\n- Example: `orderBy=createdAt desc,name asc`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries in each item.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- When included, each item's `assignments` field is populated with summaries grouped by relation type, then by entity type.\n- Example: `includes=owner,assigned`\n\n**Examples**:\n- Filter by name: `filter=name like specification`\n- Filter by language: `filter=languageName eq English`\n- Date range: `filter=createdAt gte 2024-01-01T00:00:00Z&filter=createdAt lt 2024-02-01T00:00:00Z`\n- With includes: `includes=owner,assigned&page=1&size=20`\n- Combined: `filter=languageId eq abc123&filter=name like test&includes=owner&orderBy=createdAt desc&page=1&size=20`","produces":["application/json"],"tags":["requirements"],"summary":"Get all requirements with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria (format: 'field operator value'). Can be specified multiple times.","name":"filter","in":"query"},{"type":"string","description":"Sort order (format: 'field direction' or 'field1 dir1,field2 dir2')","name":"orderBy","in":"query"},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_RequirementDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Create a new requirement (business rule, regulation, policy, etc.). Returns the persisted record at version 1.\n\n**Required**: `name`, `languageId`.\n\n**`parentId`** — optional UUID of an existing requirement for nesting; omit or `null` for a root. Cycles rejected.\n\n**`internalId`** — optional unique human-friendly identifier (e.g. `REQ-ISO-27001-A.5.1`).\n\n**`links`** — array of `{ \"title\": \"...\", \"url\": \"https://...\" }`, absolute http(s) urls.\n\n**`assignments`** — FLAT ARRAY (Shape B). Each entry: `{\"relationType\": \"...\", \"targetType\": \"...\", \"targetContainerId\": \"...\"}`. Valid relations for a requirement source: `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed` (targets: user, organization_profile); `assigned` (bidirectional — targets: process, resource, location).","consumes":["application/json"],"produces":["application/json"],"tags":["requirements"],"summary":"Add a new requirement","parameters":[{"description":"Requirement data","name":"requirement","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.AddRequirementRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.RequirementDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/requirements/bulk-delete":{"post":{"security":[{"BearerAuth":[]}],"description":"Soft-delete multiple requirements in one transactional call. Body: `{ \"ids\": [\"<uuid>\", ...] }` (1 ≤ ids ≤ 100). Whole call is rejected if any id is invalid/not found — no partial deletes.","consumes":["application/json"],"tags":["requirements"],"summary":"Bulk delete requirements","parameters":[{"description":"IDs of requirements to delete","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.BulkDeleteRequirementRequest"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid request body or IDs","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"One or more requirements not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/requirements/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a specific requirement by its unique identifier.\n\nThis endpoint retrieves a single requirement resource.\n\n**Parameters**:\n- `id`: The unique identifier of the requirement (UUID format)\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- Example: `includes=owner,assigned`","produces":["application/json"],"tags":["requirements"],"summary":"Get a single requirement by ID","parameters":[{"type":"string","description":"Requirement ID (UUID format)","name":"id","in":"path","required":true},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"}],"responses":{"200":{"description":"Successfully retrieved the requirement","schema":{"$ref":"#/definitions/dtos.RequirementDto"}},"400":{"description":"Invalid requirement ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Requirement not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"put":{"security":[{"BearerAuth":[]}],"description":"Update an existing requirement by creating a new version. Previous version is preserved.\n\n**Path `{id}`** is the requirement container UUID. All body fields are optional; omitted fields preserve the current value.\n\n**`links`** — present array replaces the entire links list (`[]` clears).\n\n**`assignments`** — FLAT ARRAY (Shape B). When present, the array **replaces** the entire assignment set. Omit to preserve. Use `PATCH /requirements/{id}/parent` to reparent only.","consumes":["application/json"],"produces":["application/json"],"tags":["requirements"],"summary":"Update a requirement","parameters":[{"type":"string","description":"Requirement container ID","name":"id","in":"path","required":true},{"description":"Requirement data","name":"requirement","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateRequirementRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.RequirementDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"delete":{"security":[{"BearerAuth":[]}],"description":"Soft-delete a requirement by its container UUID. Hidden from list/detail; history preserved for audit. Children not cascaded. Re-deleting returns `404` (`requirement.not_found`).","tags":["requirements"],"summary":"Delete a requirement","parameters":[{"type":"string","description":"Requirement ID (UUID format)","name":"id","in":"path","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid requirement ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Requirement not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/requirements/{id}/parent":{"patch":{"security":[{"BearerAuth":[]}],"description":"Reparent a requirement within the hierarchy without creating a new version.\n\nBody: `{ \"parentId\": \"<uuid>\" | null }`. `null` makes the requirement a root; a UUID moves it under an existing requirement. Self-references and cycles are rejected (`400 requirement.parent_cycle`).","consumes":["application/json"],"produces":["application/json"],"tags":["requirements"],"summary":"Update requirement parent","parameters":[{"type":"string","description":"Requirement ID (UUID format)","name":"id","in":"path","required":true},{"description":"Parent update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateRequirementParentRequest"}}],"responses":{"200":{"description":"Successfully updated requirement parent","schema":{"$ref":"#/definitions/dtos.RequirementDto"}},"400":{"description":"Invalid request body, circular reference, or self-reference","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Requirement or parent not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/resources":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all resources in the system with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `gt` (greater than), `gte` (greater than or equal)\n- `lt` (less than), `lte` (less than or equal)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*Resource Fields*:\n- `id` (string): eq, neq\n- `createdBy` (string): eq, neq\n- `modifiedBy` (string): eq, neq\n- `deletedBy` (string): eq, neq\n- `currentVersionId` (string): eq, neq\n- `lastApprovedVersionId` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `updatedAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `deletedAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n*User Fields*:\n- `createdByName` (string): eq, neq, like\n- `createdByEmail` (string): eq, neq, like\n\n*Version Fields*:\n- `parentId` (string): eq, neq\n- `versionNumber` (string): eq, neq, like\n\n*Translation Fields*:\n- `name` (string): eq, neq, like\n- `description` (string): eq, neq, like\n- `languageId` (string): eq, neq\n\n*Language Fields*:\n- `languageName` (string): eq, neq, like\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction` (direction: asc/desc)\n- All filterable fields above are also sortable\n- Example: `orderBy=createdAt desc,name asc`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries in each item.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- When included, each item's `assignments` field is populated with summaries grouped by relation type, then by entity type.\n- Example: `includes=owner,assigned`\n\n**Examples**:\n- Filter by name: `filter=name like handbook`\n- Filter by language: `filter=languageName eq English`\n- Date range: `filter=createdAt gte 2024-01-01T00:00:00Z&filter=createdAt lt 2024-02-01T00:00:00Z`\n- With includes: `includes=owner,assigned&page=1&size=20`\n- Combined: `filter=languageId eq abc123&filter=name like test&includes=owner&orderBy=createdAt desc&page=1&size=20`","produces":["application/json"],"tags":["resources"],"summary":"Get all resources with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria (format: 'field operator value'). Can be specified multiple times.","name":"filter","in":"query"},{"type":"string","description":"Sort order (format: 'field direction' or 'field1 dir1,field2 dir2')","name":"orderBy","in":"query"},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_ResourceDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"post":{"security":[{"BearerAuth":[]}],"description":"Create a new resource (person, system, tool, document, etc.). Returns the persisted record at version 1.\n\n**Required**: `name`, `languageId` (UUID of an existing Language record).\n\n**`parentId`** — optional UUID of an existing resource for nesting; omit or `null` for a root resource. Cycles rejected.\n\n**`internalId`** — optional unique human-friendly identifier.\n\n**`links`** — array of `{ \"title\": \"...\", \"url\": \"https://...\" }`, absolute http(s) urls.\n\n**`assignments`** — FLAT ARRAY (Shape B). Each entry: `{\"relationType\": \"...\", \"targetType\": \"...\", \"targetContainerId\": \"...\"}`. Valid relations for a resource source: `owner`, `coOwner`, `responsible`, `accountable`, `consulted`, `informed` (targets: user, organization_profile); `assigned` (bidirectional — targets: process, location, requirement).\n\nExample:\n\n```json\n{\n\"name\": \"Onboarding Handbook\",\n\"languageId\": \"b5e0a1f4-...\",\n\"internalId\": \"RES-DOC-014\",\n\"assignments\": [\n{\"relationType\": \"owner\",    \"targetType\": \"user\",    \"targetContainerId\": \"user_2abc...\"},\n{\"relationType\": \"assigned\", \"targetType\": \"process\", \"targetContainerId\": \"0e1f-...\"}\n]\n}\n```","consumes":["application/json"],"produces":["application/json"],"tags":["resources"],"summary":"Add a new resource","parameters":[{"description":"Resource data","name":"resource","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.AddResourceRequest"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/dtos.ResourceDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/resources/bulk-delete":{"post":{"security":[{"BearerAuth":[]}],"description":"Soft-delete multiple resources in one transactional call. Body: `{ \"ids\": [\"<uuid>\", ...] }` (1 ≤ ids ≤ 100). Whole call is rejected if any id is invalid/not found — no partial deletes. Children not cascaded.","consumes":["application/json"],"tags":["resources"],"summary":"Bulk delete resources","parameters":[{"description":"IDs of resources to delete","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.BulkDeleteResourceRequest"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid request body or IDs","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"One or more resources not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/resources/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a specific resource by its unique identifier\n\n**Includes**: Use the `includes` query parameter to embed related assignment summaries.\n- Format: `includes=relationType1,relationType2`\n- Allowed values: `owner`, `responsible`, `accountable`, `consulted`, `informed`, `assigned`\n- Example: `includes=owner,assigned`","produces":["application/json"],"tags":["resources"],"summary":"Get a single resource by ID","parameters":[{"type":"string","description":"Resource ID (UUID)","name":"id","in":"path","required":true},{"type":"string","description":"Comma-separated list of relation types to include (e.g., owner, responsible, assigned)","name":"includes","in":"query"}],"responses":{"200":{"description":"Successfully retrieved the resource","schema":{"$ref":"#/definitions/dtos.ResourceDto"}},"400":{"description":"Invalid resource ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"put":{"security":[{"BearerAuth":[]}],"description":"Update an existing resource by creating a new version. Previous version is preserved.\n\n**Path `{id}`** is the resource container UUID (stable across versions).\n\nAll body fields are optional; omitted fields preserve the current value. `internalId` accepts `null` to clear.\n\n**`links`** — present array replaces the entire links list (`[]` clears).\n\n**`assignments`** — FLAT ARRAY (Shape B). When present, the array **replaces** the entire assignment set. Omit to preserve. Use `PATCH /resources/{id}/parent` to reparent only.\n\nSupports `If-Match` for optimistic concurrency (412 on stale ETag).","consumes":["application/json"],"produces":["application/json"],"tags":["resources"],"summary":"Update a resource","parameters":[{"type":"string","description":"Resource container ID","name":"id","in":"path","required":true},{"description":"Resource data","name":"resource","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateResourceRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/dtos.ResourceDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"delete":{"security":[{"BearerAuth":[]}],"description":"Soft-delete a resource by its container UUID. Hidden from list/detail; history preserved for audit. Children not cascaded. Idempotent: re-deleting returns `404` (`resource.not_found`).","tags":["resources"],"summary":"Delete a resource","parameters":[{"type":"string","description":"Resource ID (UUID format)","name":"id","in":"path","required":true}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid resource ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/resources/{id}/parent":{"patch":{"security":[{"BearerAuth":[]}],"description":"Reparent a resource within the hierarchy without creating a new version.\n\nBody: `{ \"parentId\": \"<uuid>\" | null }`. `null` makes the resource a root; a UUID moves it under an existing resource. Self-references and cycles are rejected (`400 resource.parent_cycle`).","consumes":["application/json"],"produces":["application/json"],"tags":["resources"],"summary":"Update resource parent","parameters":[{"type":"string","description":"Resource ID (UUID format)","name":"id","in":"path","required":true},{"description":"Parent update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateResourceParentRequest"}}],"responses":{"200":{"description":"Successfully updated resource parent","schema":{"$ref":"#/definitions/dtos.ResourceDto"}},"400":{"description":"Invalid request body, circular reference, or self-reference","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"Resource or parent not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/users":{"get":{"security":[{"BearerAuth":[]}],"description":"Get all users in the system with support for dynamic filtering, sorting, and pagination.\n\n**Filtering**: Use the `filter` query parameter to filter results. Format: `filter=field operator value`\n\n**Operators**:\n- `eq` (equals), `neq` (not equals)\n- `gt` (greater than), `gte` (greater than or equal)\n- `lt` (less than), `lte` (less than or equal)\n- `like` (pattern matching, case-insensitive)\n\n**Filterable Fields with Allowed Operators**:\n\n*User Fields*:\n- `id` (string): eq, neq\n- `clerkUserId` (string): eq, neq\n- `email` (string): eq, neq, like\n- `firstName` (string): eq, neq, like\n- `lastName` (string): eq, neq, like\n- `isActive` (boolean): eq, neq\n- `createdBy` (string): eq, neq\n- `modifiedBy` (string): eq, neq\n- `deletedBy` (string): eq, neq\n- `createdAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `modifiedAt` (timestamp): eq, neq, gt, gte, lt, lte\n- `deletedAt` (timestamp): eq, neq, gt, gte, lt, lte\n\n**Sorting**: Use the `orderBy` query parameter. Format: `orderBy=field direction` (direction: asc/desc)\n- All filterable fields above are also sortable\n- Example: `orderBy=createdAt desc,email asc`\n\n**Pagination**:\n- `page`: Page number (default: 1, must be >= 1)\n- `size`: Items per page (default: 20, max: 100, must be >= 1)\n\n**Examples**:\n- Filter by email: `filter=email like smith`\n- Filter by name: `filter=firstName eq John`\n- Filter active users: `filter=isActive eq true`\n- Date range: `filter=createdAt gte 2024-01-01T00:00:00Z&filter=createdAt lt 2024-02-01T00:00:00Z`\n- Combined: `filter=email like example.com&orderBy=createdAt desc&page=1&size=20`","produces":["application/json"],"tags":["users"],"summary":"Get all users with filtering, sorting, and pagination","parameters":[{"type":"array","items":{"type":"string"},"collectionFormat":"multi","description":"Filter criteria (format: 'field operator value'). Can be specified multiple times.","name":"filter","in":"query"},{"type":"string","description":"Sort order (format: 'field direction' or 'field1 dir1,field2 dir2')","name":"orderBy","in":"query"},{"minimum":1,"type":"integer","description":"Page number (default: 1)","name":"page","in":"query"},{"minimum":1,"type":"integer","description":"Page size (default: 20)","name":"size","in":"query"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/models.PagedResult-dtos_UserDto"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/users/me/preferences":{"get":{"security":[{"BearerAuth":[]}],"description":"Return the UI preferences for the caller (resolved from the auth token — no user ID in the URL). Defaults are returned if the user has never saved preferences. Response includes `themeMode` (`light`/`dark`/`system`), `language` (BCP-47 string like `en` or `de`), `tabletNavExpanded` (bool), and `favorites` (map of entity-type plural → array of container UUIDs).","produces":["application/json"],"tags":["users"],"summary":"Get preferences for the authenticated user","responses":{"200":{"description":"User preferences","schema":{"$ref":"#/definitions/dtos.UserPreferencesDto"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"put":{"security":[{"BearerAuth":[]}],"description":"Partially update the caller's UI preferences. All body fields are optional; only provided fields change.\n\nFields:\n- `themeMode` — `\"light\"`, `\"dark\"`, or `\"system\"`.\n- `language` — BCP-47 string (e.g. `\"en\"`, `\"de\"`). Must correspond to a supported language in the org.\n- `tabletNavExpanded` — bool.\n\nFavorites are managed separately via `PUT /users/me/preferences/favorites`. Returns the full updated preferences DTO.","consumes":["application/json"],"produces":["application/json"],"tags":["users"],"summary":"Update preferences for the authenticated user","parameters":[{"description":"Preferences update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateUserPreferencesRequest"}}],"responses":{"200":{"description":"Updated preferences","schema":{"$ref":"#/definitions/dtos.UserPreferencesDto"}},"400":{"description":"Invalid themeMode or language value","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/users/me/preferences/favorites":{"put":{"security":[{"BearerAuth":[]}],"description":"Add or remove entities from the caller's favorites list (used to flag items with the star icon in the UI).\n\nBody: `{ \"entityType\": \"<plural>\", \"entityIds\": [\"<uuid>\", ...], \"isFavorite\": true | false }` — all required.\n- `entityType` — plural form, one of `processes`, `resources`, `locations`, `requirements`, `organizationProfiles`.\n- `entityIds` — 1+ container UUIDs in that domain.\n- `isFavorite` — `true` to favorite the listed ids, `false` to unfavorite. Idempotent — already-favorited / already-unfavorited ids are no-ops.\n\nFavorites surface in `GET /users/me/preferences` and on enriched entity reads (`isFavorite` boolean per item).","consumes":["application/json"],"produces":["application/json"],"tags":["users"],"summary":"Toggle a favorite for the authenticated user","parameters":[{"description":"Toggle favorite request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.ToggleFavoriteRequest"}}],"responses":{"200":{"description":"Favorite toggled successfully"},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}},"/users/{id}":{"get":{"security":[{"BearerAuth":[]}],"description":"Retrieve a single user by their internal UUID. Returns Clerk-derived data (firstName, lastName, email, clerkUserId) plus org-scoped fields (role, isActive, language). Users are auto-provisioned in the tenant DB on their first org-scoped request — Clerk owns the lifecycle, so there is no `POST /users`.\n\nUse `GET /users?filter=clerkUserId eq user_2abc...` if you only know the Clerk ID. To accept either form in assignment payloads, the assignment endpoints already resolve `user_...` IDs automatically.","produces":["application/json"],"tags":["users"],"summary":"Get a single user by ID","parameters":[{"type":"string","description":"User ID (UUID format)","name":"id","in":"path","required":true}],"responses":{"200":{"description":"Successfully retrieved the user","schema":{"$ref":"#/definitions/dtos.UserDto"}},"400":{"description":"Invalid user ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"User not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}},"patch":{"security":[{"BearerAuth":[]}],"description":"Soft-deactivate or reactivate a user in this organization. Path `{id}` is the internal user UUID. Body: `{ \"isActive\": true | false }` (required).\n\nDeactivated users keep their data and assignments but cannot authenticate against this org's endpoints. Reactivation restores access. Clerk org membership is **not** touched — to fully remove a user, use the Clerk dashboard. The user cannot deactivate themselves (`400 user.cannot_self_deactivate`).","consumes":["application/json"],"produces":["application/json"],"tags":["users"],"summary":"Update user active status","parameters":[{"type":"string","description":"User ID (UUID format)","name":"id","in":"path","required":true},{"description":"User status update request","name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/endpoints.UpdateUserStatusRequest"}}],"responses":{"200":{"description":"Successfully updated user status","schema":{"$ref":"#/definitions/dtos.UserDto"}},"400":{"description":"Invalid request body or user ID format","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"401":{"description":"Unauthorized - authentication required","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"404":{"description":"User not found","schema":{"$ref":"#/definitions/models.ErrorInfo"}},"500":{"description":"Internal server error","schema":{"$ref":"#/definitions/models.ErrorInfo"}}}}}},"definitions":{"assignment.AssignmentDto":{"type":"object","properties":{"contextContainerId":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"id":{"type":"string"},"relationType":{"type":"string"},"sourceContainerId":{"type":"string"},"sourceId":{"type":"string"},"sourceName":{"type":"string"},"sourceType":{"type":"string"},"targetContainerId":{"type":"string"},"targetName":{"type":"string"},"targetType":{"type":"string"}}},"assignment.AssignmentEntry":{"type":"object","required":["targetContainerId"],"properties":{"contextContainerId":{"type":"string"},"targetContainerId":{"type":"string"}}},"assignment.AssignmentInput":{"type":"object","required":["relationType","targetContainerId","targetType"],"properties":{"contextContainerId":{"type":"string"},"relationType":{"type":"string"},"targetContainerId":{"type":"string"},"targetType":{"type":"string"}}},"assignment.AssignmentSummaryDto":{"type":"object","properties":{"entityType":{"type":"string"},"externalId":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"assignment.AssignmentsByType":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentSummaryDto"}}}},"commands.InviteMemberResult":{"type":"object","properties":{"message":{"type":"string"},"type":{"$ref":"#/definitions/commands.InviteMemberResultType"}}},"commands.InviteMemberResultType":{"type":"string","enum":["added","invited","updated"],"x-enum-varnames":["InviteMemberResultAdded","InviteMemberResultInvited","InviteMemberResultUpdated"]},"commands.UpdateMemberRoleResult":{"type":"object","properties":{"clerkUserId":{"type":"string"},"role":{"type":"string"},"userId":{"type":"string"}}},"core.LocationLink":{"type":"object","properties":{"order":{"type":"integer"},"title":{"type":"string"},"url":{"type":"string"}}},"core.OrganizationProfileLink":{"type":"object","properties":{"order":{"type":"integer"},"title":{"type":"string"},"url":{"type":"string"}}},"core.ProcessLink":{"type":"object","properties":{"order":{"type":"integer"},"title":{"type":"string"},"url":{"type":"string"}}},"core.RequirementLink":{"type":"object","properties":{"order":{"type":"integer"},"title":{"type":"string"},"url":{"type":"string"}}},"core.ResourceLink":{"type":"object","properties":{"order":{"type":"integer"},"title":{"type":"string"},"url":{"type":"string"}}},"dtos.ApiKeyCreatedDto":{"type":"object","properties":{"clerkUserId":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"expiresAt":{"type":"string"},"id":{"type":"string"},"lastUsedAt":{"type":"string"},"name":{"type":"string"},"revokedAt":{"type":"string"},"scopes":{"type":"string"},"token":{"description":"Plaintext token — shown only once","type":"string"},"tokenPrefix":{"type":"string"}}},"dtos.ApiKeyDto":{"type":"object","properties":{"clerkUserId":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"expiresAt":{"type":"string"},"id":{"type":"string"},"lastUsedAt":{"type":"string"},"name":{"type":"string"},"revokedAt":{"type":"string"},"scopes":{"type":"string"},"tokenPrefix":{"type":"string"}}},"dtos.AuditLogDto":{"type":"object","properties":{"actionType":{"type":"string"},"actorType":{"type":"string"},"afterState":{"$ref":"#/definitions/dtos.JSONObject"},"beforeState":{"$ref":"#/definitions/dtos.JSONObject"},"description":{"type":"string"},"entityId":{"type":"integer"},"entityType":{"type":"string"},"id":{"type":"integer"},"metadata":{"$ref":"#/definitions/dtos.JSONObject"},"orgId":{"type":"string"},"status":{"type":"string"},"timestamp":{"type":"string"},"userFullName":{"type":"string"}}},"dtos.BpmnModelPayloadDto":{"type":"object","properties":{"jsonPayload":{"type":"object"},"modelId":{"type":"string"}}},"dtos.CheckDatabasesExistenceResult":{"type":"object","properties":{"databases":{"type":"array","items":{"$ref":"#/definitions/dtos.DatabaseCheckDto"}}}},"dtos.CreateBpmnModelResponse":{"type":"object","properties":{"jsonPayload":{"type":"object"},"modelId":{"type":"string"},"newVersionId":{"type":"string"},"oldVersionId":{"type":"string"}}},"dtos.DatabaseCheckDto":{"type":"object","properties":{"slug":{"type":"string"},"status":{"description":"\"exists\" or \"not_found\"","type":"string"}}},"dtos.JSONObject":{"type":"object","additionalProperties":true},"dtos.LocationDto":{"type":"object","properties":{"assignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"childrenCount":{"type":"integer"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"currentVersionId":{"type":"string"},"description":{"type":"string"},"entityType":{"type":"string"},"id":{"type":"string"},"internalId":{"type":"string"},"isFavorite":{"description":"IsFavorite reflects whether the current request's user has favorited this location.\nPopulated by a Postgres LATERAL JOIN in GetAll / GetByID when the DB dialect is postgres;\ndefaults to false for non-postgres dialects (e.g., SQLite-backed unit tests).","type":"boolean"},"languageName":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.LocationLink"}},"modifiedAt":{"type":"string"},"modifiedBy":{"$ref":"#/definitions/models.UserRef"},"name":{"type":"string"},"parentId":{"type":"string"},"versionNumber":{"type":"string"},"versionStatus":{"type":"string"}}},"dtos.OrgChartModelDto":{"type":"object","properties":{"jsonPayload":{"type":"object"},"modelId":{"type":"string"}}},"dtos.OrganizationDto":{"type":"object","properties":{"dbName":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"}}},"dtos.OrganizationProfileDto":{"type":"object","properties":{"abbreviation":{"type":"string"},"assignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"childrenCount":{"type":"integer"},"contactAddress":{"type":"string"},"contactCity":{"type":"string"},"contactCountry":{"type":"string"},"contactEmail":{"type":"string"},"contactName":{"description":"External-partner contact fields (only populated when EntityType=external_partner).","type":"string"},"contactPhone":{"type":"string"},"contactPostalCode":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"currentVersionId":{"type":"string"},"description":{"type":"string"},"entityType":{"type":"string"},"id":{"type":"string"},"internalId":{"type":"string"},"isFavorite":{"description":"IsFavorite reflects whether the current request's user has favorited this organization profile.\nPopulated by a Postgres LATERAL JOIN in GetAll / GetByID when the DB dialect is postgres;\ndefaults to false for non-postgres dialects (e.g., SQLite-backed unit tests).","type":"boolean"},"languageName":{"type":"string"},"linkedLocations":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentSummaryDto"}},"linkedProcesses":{"description":"Detail-page \"linked entity\" tabs (Tab 3 onwards). Each slice is filled only\nwhen the client asks for it on the GET (e.g. `?includes=linkedProcesses`)\nand lists every entity that points at this org-profile via owner /\nresponsible / consulted / etc. omitempty keeps the field off the wire\nwhen the tab wasn't requested. gorm:\"-\" because the enricher populates\nthese after the row is scanned, not from a DB column.","type":"array","items":{"$ref":"#/definitions/assignment.AssignmentSummaryDto"}},"linkedRequirements":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentSummaryDto"}},"linkedResources":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentSummaryDto"}},"links":{"type":"array","items":{"$ref":"#/definitions/core.OrganizationProfileLink"}},"modifiedAt":{"type":"string"},"modifiedBy":{"$ref":"#/definitions/models.UserRef"},"name":{"type":"string"},"parentId":{"type":"string"},"pinnedOrder":{"description":"PinnedOrder determines the display order in the tile view (global state).\nnil = not pinned; a positive integer = pinned at that position.","type":"integer"},"versionNumber":{"type":"string"},"versionStatus":{"type":"string"}}},"dtos.OrganizationProfileTreeDto":{"type":"object","properties":{"abbreviation":{"type":"string"},"assignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"description":{"type":"string"},"entityType":{"type":"string"},"id":{"type":"string"},"internalId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.OrganizationProfileLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"dtos.ProcessDto":{"type":"object","properties":{"assignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"bpmnAssignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"childrenCount":{"type":"integer"},"createdBy":{"type":"string"},"createdByName":{"description":"User name who created the process","type":"string"},"currentVersionId":{"description":"Current version of the process","type":"string"},"description":{"description":"Description from version_translations","type":"string"},"entityType":{"type":"string"},"id":{"type":"string"},"internalId":{"description":"Human-readable internal identifier","type":"string"},"isFavorite":{"description":"IsFavorite reflects whether the current request's user has favorited this process.\nPopulated by a Postgres LATERAL JOIN in GetAll / GetByID when the DB dialect is postgres;\ndefaults to false for non-postgres dialects (e.g., SQLite-backed unit tests).","type":"boolean"},"languageName":{"description":"Name of the translation language","type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.ProcessLink"}},"modifiedAt":{"description":"When the current version was last modified","type":"string"},"modifiedBy":{"$ref":"#/definitions/models.UserRef"},"name":{"description":"Name from version_translations","type":"string"},"objective":{"type":"string"},"parentId":{"description":"From processes.parent_id","type":"string"},"processMaturity":{"type":"string"},"targetAudience":{"type":"string"},"versionNumber":{"description":"Current version number","type":"string"},"versionStatus":{"description":"Current version status","type":"string"}}},"dtos.RequirementDto":{"type":"object","properties":{"assignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"childrenCount":{"type":"integer"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"currentVersionId":{"type":"string"},"description":{"type":"string"},"entityType":{"type":"string"},"id":{"type":"string"},"internalId":{"type":"string"},"isFavorite":{"description":"IsFavorite reflects whether the current request's user has favorited this requirement.\nPopulated by a Postgres LATERAL JOIN in GetAll / GetByID when the DB dialect is postgres;\ndefaults to false for non-postgres dialects (e.g., SQLite-backed unit tests).","type":"boolean"},"languageName":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.RequirementLink"}},"modifiedAt":{"type":"string"},"modifiedBy":{"$ref":"#/definitions/models.UserRef"},"name":{"type":"string"},"parentId":{"type":"string"},"versionNumber":{"type":"string"},"versionStatus":{"type":"string"}}},"dtos.ResourceDto":{"type":"object","properties":{"assignments":{"$ref":"#/definitions/assignment.AssignmentsByType"},"childrenCount":{"type":"integer"},"createdBy":{"type":"string"},"createdByName":{"type":"string"},"currentVersionId":{"type":"string"},"description":{"type":"string"},"entityType":{"type":"string"},"id":{"type":"string"},"internalId":{"type":"string"},"isFavorite":{"description":"IsFavorite reflects whether the current request's user has favorited this resource.\nPopulated by a Postgres LATERAL JOIN in GetAll / GetByID when the DB dialect is postgres;\ndefaults to false for non-postgres dialects (e.g., SQLite-backed unit tests).","type":"boolean"},"languageName":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.ResourceLink"}},"modifiedAt":{"type":"string"},"modifiedBy":{"$ref":"#/definitions/models.UserRef"},"name":{"type":"string"},"parentId":{"type":"string"},"versionNumber":{"type":"string"},"versionStatus":{"type":"string"}}},"dtos.UserDto":{"type":"object","properties":{"clerkUserId":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"deletedAt":{"type":"string"},"deletedBy":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"id":{"type":"string"},"isActive":{"type":"boolean"},"lastName":{"type":"string"},"modifiedAt":{"type":"string"},"modifiedBy":{"type":"string"}}},"dtos.UserPreferencesDto":{"type":"object","properties":{"favorites":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"language":{"type":"string"},"tabletNavExpanded":{"type":"boolean"},"themeMode":{"type":"string"}}},"endpoints.AddLocationRequest":{"type":"object","required":["languageId","name"],"properties":{"assignments":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentInput"}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.LocationLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.AddOrganizationProfileRequest":{"type":"object","required":["entityType","languageId","name"],"properties":{"abbreviation":{"type":"string"},"assignments":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentEntry"}}}},"contactAddress":{"type":"string"},"contactCity":{"type":"string"},"contactCountry":{"type":"string"},"contactEmail":{"type":"string"},"contactName":{"description":"External-partner contact fields — only used when EntityType == \"external_partner\".","type":"string"},"contactPhone":{"type":"string"},"contactPostalCode":{"type":"string"},"description":{"type":"string"},"entityType":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.OrganizationProfileLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.AddProcessRequest":{"type":"object","required":["entityType","languageId","name"],"properties":{"assignments":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentEntry"}}}},"description":{"type":"string"},"entityType":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.ProcessLink"}},"name":{"type":"string"},"objective":{"type":"string"},"parentId":{"type":"string"},"processMaturity":{"type":"string"},"targetAudience":{"type":"string"}}},"endpoints.AddRequirementRequest":{"type":"object","required":["languageId","name"],"properties":{"assignments":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentInput"}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.RequirementLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.AddResourceRequest":{"type":"object","required":["languageId","name"],"properties":{"assignments":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentInput"}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.ResourceLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.BulkDeleteLocationRequest":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"items":{"type":"string"}}}},"endpoints.BulkDeleteOrganizationProfileRequest":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"items":{"type":"string"}}}},"endpoints.BulkDeleteProcessRequest":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"items":{"type":"string"}}}},"endpoints.BulkDeleteRequirementRequest":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"items":{"type":"string"}}}},"endpoints.BulkDeleteResourceRequest":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"items":{"type":"string"}}}},"endpoints.CreateApiKeyRequest":{"type":"object","required":["name","scopes"],"properties":{"expiresAt":{"type":"string"},"name":{"type":"string"},"scopes":{"type":"array","minItems":1,"items":{"type":"string"}}}},"endpoints.CreateOrganizationRequest":{"type":"object","required":["name","slug"],"properties":{"externalOrgExists":{"description":"Optional: skip gateway creation if org already exists in Clerk","type":"boolean"},"name":{"type":"string","minLength":1},"slug":{"type":"string","maxLength":63,"minLength":2},"withSampleData":{"description":"Optional: whether to include sample/test data","type":"boolean"}}},"endpoints.InviteMemberRequest":{"type":"object","properties":{"clerkUserId":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"}}},"endpoints.SetPinnedOrderRequest":{"type":"object","required":["pin"],"properties":{"pin":{"type":"boolean"}}},"endpoints.ToggleFavoriteRequest":{"type":"object","required":["entityIds","entityType","isFavorite"],"properties":{"entityIds":{"type":"array","minItems":1,"items":{"type":"string"}},"entityType":{"type":"string"},"isFavorite":{"type":"boolean"}}},"endpoints.UpdateLocationParentRequest":{"type":"object","properties":{"parentId":{"type":"string"}}},"endpoints.UpdateLocationRequest":{"type":"object","required":["languageId","name"],"properties":{"assignments":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentInput"}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.LocationLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.UpdateMemberRoleRequest":{"type":"object","properties":{"role":{"type":"string"}}},"endpoints.UpdateOrganizationProfileParentRequest":{"type":"object","properties":{"parentId":{"type":"string"}}},"endpoints.UpdateOrganizationProfileRequest":{"type":"object","properties":{"abbreviation":{"type":"string"},"assignments":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentEntry"}}}},"contactAddress":{"type":"string"},"contactCity":{"type":"string"},"contactCountry":{"type":"string"},"contactEmail":{"type":"string"},"contactName":{"description":"External-partner contact fields — nil = preserve current.","type":"string"},"contactPhone":{"type":"string"},"contactPostalCode":{"type":"string"},"description":{"type":"string"},"entityType":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.OrganizationProfileLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.UpdateProcessParentRequest":{"type":"object","properties":{"parentId":{"type":"string"}}},"endpoints.UpdateProcessRequest":{"type":"object","properties":{"assignments":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentEntry"}}}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.ProcessLink"}},"name":{"type":"string"},"objective":{"type":"string"},"parentId":{"type":"string"},"processMaturity":{"type":"string"},"targetAudience":{"type":"string"}}},"endpoints.UpdateRequirementParentRequest":{"type":"object","properties":{"parentId":{"type":"string"}}},"endpoints.UpdateRequirementRequest":{"type":"object","required":["languageId","name"],"properties":{"assignments":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentInput"}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.RequirementLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.UpdateResourceParentRequest":{"type":"object","properties":{"parentId":{"type":"string"}}},"endpoints.UpdateResourceRequest":{"type":"object","required":["languageId","name"],"properties":{"assignments":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentInput"}},"description":{"type":"string"},"internalId":{"type":"string"},"languageId":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/definitions/core.ResourceLink"}},"name":{"type":"string"},"parentId":{"type":"string"}}},"endpoints.UpdateUserPreferencesRequest":{"type":"object","properties":{"language":{"type":"string"},"tabletNavExpanded":{"type":"boolean"},"themeMode":{"type":"string"}}},"endpoints.UpdateUserStatusRequest":{"type":"object","properties":{"isActive":{"type":"boolean"}}},"models.ErrorInfo":{"type":"object","properties":{"code":{"type":"string"},"correlationId":{"type":"string"},"message":{"type":"string"}}},"models.PagedResult-assignment_AssignmentDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/assignment.AssignmentDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_AuditLogDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.AuditLogDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_LocationDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.LocationDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_OrganizationProfileDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.OrganizationProfileDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_ProcessDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.ProcessDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_RequirementDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.RequirementDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_ResourceDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.ResourceDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.PagedResult-dtos_UserDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/definitions/dtos.UserDto"}},"page":{"type":"integer"},"size":{"type":"integer"},"total":{"type":"integer"}}},"models.UserRef":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}},"securityDefinitions":{"BearerAuth":{"description":"Type \"Bearer\" followed by a space and JWT token.","type":"apiKey","name":"Authorization","in":"header"}}}