{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cosuno/json-schema/cosuno-current-user-response-schema.json",
  "title": "CurrentUserResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cosuno-current-user-api-openapi.yml#/components/schemas/CurrentUserResponse",
  "properties": {
    "id": {
      "type": "string",
      "description": "ID of the user."
    },
    "email": {
      "type": "string",
      "description": "Email address of the user. Also used as their login identifier."
    },
    "status": {
      "$ref": "#/$defs/USER_STATUS",
      "description": "Current status of the user."
    },
    "firstName": {
      "type": "string",
      "description": "Given name of the user."
    },
    "lastName": {
      "type": "string",
      "description": "Family name of the user."
    },
    "type": {
      "$ref": "#/$defs/USER_TYPE",
      "description": "Account type of the user. Values starting with `custom` indicate a custom user role (see `customUserRoleId`)."
    },
    "customUserRoleId": {
      "type": "string",
      "description": "ID of the custom user role assigned to the user. Present only when `type` refers to a custom user role."
    },
    "workspaceId": {
      "type": "string",
      "description": "ID of the workspace (company tenant) the user belongs to."
    },
    "offices": {
      "items": {
        "$ref": "#/$defs/OfficeResponse"
      },
      "type": "array",
      "description": "Offices the user has access to."
    }
  },
  "required": [
    "id",
    "email",
    "status",
    "type",
    "workspaceId",
    "offices"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "OFFICE_STATUS": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    },
    "OfficeResponse": {
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the office."
        },
        "name": {
          "type": "string",
          "description": "Display name of the office."
        },
        "status": {
          "$ref": "#/$defs/OFFICE_STATUS",
          "description": "Current status of the office. Inactive offices can no longer have new projects or users assigned to them."
        }
      },
      "required": [
        "id",
        "name",
        "status"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "USER_STATUS": {
      "type": "string",
      "enum": [
        "approvalPending",
        "adminApprovalPending",
        "invited",
        "inviteCanceled",
        "inviteFailed",
        "inviteRequested",
        "active",
        "inactive"
      ]
    },
    "USER_TYPE": {
      "type": "string",
      "enum": [
        "custom",
        "administrator",
        "employee",
        "guest",
        "collaborator",
        "manager"
      ]
    }
  }
}