{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/runn/json-schema/runn-user-schema.json",
  "title": "User",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/runn-users-api-openapi.yml#/components/schemas/User",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "firstName": {
      "type": [
        "string",
        "null"
      ]
    },
    "lastName": {
      "type": [
        "string",
        "null"
      ]
    },
    "email": {
      "type": "string"
    },
    "personId": {
      "type": [
        "integer",
        "null"
      ]
    },
    "permissions": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "superuser",
            "admin",
            "editor",
            "viewer_all",
            "viewer_basic",
            "timesheet_only"
          ],
          "deprecated": true,
          "description": "Mapped permission type (deprecated: use userType)"
        },
        "userType": {
          "type": "string",
          "enum": [
            "superuser",
            "admin",
            "manager",
            "contributor"
          ],
          "description": "The user's unmapped database permission type"
        },
        "financial": {
          "type": "string",
          "enum": [
            "all",
            "no_salaries",
            "restricted",
            "none"
          ]
        },
        "editProjects": {
          "type": "string",
          "enum": [
            "all",
            "specific",
            "restricted",
            "none"
          ],
          "deprecated": true,
          "description": "Edit projects permission (deprecated: use manageProjects)"
        },
        "manageProjects": {
          "type": "string",
          "enum": [
            "all",
            "specific",
            "restricted",
            "none"
          ]
        },
        "editOthers": {
          "type": "string",
          "enum": [
            "all",
            "none"
          ],
          "deprecated": true,
          "description": "Edit others permission (deprecated: use managePeople)"
        },
        "managePeople": {
          "type": "string",
          "enum": [
            "all",
            "restricted",
            "none"
          ]
        },
        "manageAccount": {
          "type": "boolean"
        },
        "addAllPeopleToProjects": {
          "type": "boolean"
        },
        "viewPlanner": {
          "type": "boolean"
        }
      },
      "required": [
        "type",
        "userType",
        "financial",
        "editProjects",
        "manageProjects",
        "editOthers",
        "managePeople",
        "manageAccount",
        "addAllPeopleToProjects",
        "viewPlanner"
      ]
    },
    "peopleTeams": {
      "description": "Teams this user manages people through when their managePeople permission is 'restricted'. Always returned; empty when they have no team grants.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          }
        },
        "required": [
          "id"
        ]
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp of when the object was created."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp of when the object was last updated."
    }
  },
  "required": [
    "id",
    "firstName",
    "lastName",
    "email",
    "personId",
    "permissions",
    "peopleTeams",
    "createdAt",
    "updatedAt"
  ]
}