{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.api.finra.org/v1/finproGW/finproTasks.json",
  "$dataVersion": "1.2.0",
  "title": "Dashboard Tasks Internal",
  "$Description": "Returns pending tasks for an individual across U4 Edits, U4 Esignature, CE, Attestation, Exam Schedule, and Disclosure Letter categories, consumed by the firm-facing FINPRO dashboard. Returns HTTP 200 on full success or HTTP 207 when one or more downstream services are unavailable (partial response with errors array).",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "individualCrdNumber",
    "finproDashboardLink",
    "firstName",
    "lastName",
    "tasks"
  ],
  "properties": {
    "individualCrdNumber": {
      "type": "number",
      "description": "CRD number of the individual"
    },
    "finproDashboardLink": {
      "type": "string",
      "format": "uri",
      "maxLength": 500,
      "description": "URL of the individual's dashboard page on Finpro Gateway"
    },
    "firstName": {
      "type": ["string", "null"],
      "maxLength": 100,
      "description": "First name of the individual. JSON null (not the string 'null') when the downstream service is unavailable."
    },
    "middleName": {
      "type": ["string", "null"],
      "maxLength": 100,
      "description": "Middle name of the individual. JSON null (not the string 'null') when the downstream service is unavailable or middle name is not provided."
    },
    "lastName": {
      "type": ["string", "null"],
      "maxLength": 100,
      "description": "Last name of the individual. JSON null (not the string 'null') when the downstream service is unavailable."
    },
    "tasks": {
      "type": "array",
      "description": "Array of task groups for the individual. Empty when no pending tasks exist or all downstream sources are unavailable.",
      "items": {
        "type": "object",
        "required": ["taskCategory", "taskId", "subTasks"],
        "additionalProperties": false,
        "properties": {
          "taskCategory": {
            "type": "string",
            "enum": ["U4 Edits", "U4 Esignature", "CE", "Attestation", "Exam Schedule", "Disclosure Letter"],
            "description": "Category of the task group"
          },
          "taskId": {
            "type": "string",
            "maxLength": 200,
            "description": "Unique identifier for the task. Non-empty only for CE tasks; empty string for all other categories."
          },
          "taskDesc": {
            "type": "string",
            "maxLength": 500,
            "description": "Top-level description of the task group. Present only for CE tasks."
          },
          "subTasks": {
            "type": "array",
            "description": "Array of sub-tasks within this task group",
            "items": {
              "type": "object",
              "required": ["taskDesc", "dueDate", "deepLinkForTask"],
              "additionalProperties": false,
              "properties": {
                "taskDesc": {
                  "type": "string",
                  "maxLength": 500,
                  "description": "Description of the sub-task"
                },
                "dueDate": {
                  "type": ["string", "null"],
                  "maxLength": 10,
                  "description": "Due date for the sub-task. Format is YYYY-MM-DD for Exam Schedule and CE tasks; JSON null (not the string 'null') for U4 Edits, U4 Esignature, Attestation, and Disclosure Letter tasks."
                },
                "deepLinkForTask": {
                  "type": "string",
                  "maxLength": 1000,
                  "description": "Direct deep-link URL to the task. Non-empty only for U4 Edits, U4 Esignature, CE, and Exam Schedule tasks. Empty string for Attestation and Disclosure Letter tasks."
                }
              }
            }
          }
        }
      }
    },
    "errors": {
      "type": "array",
      "description": "Present only on HTTP 207. Lists downstream services that failed to respond. Tasks from failed sources are omitted from the tasks array.",
      "items": {
        "type": "object",
        "required": ["task", "source", "message"],
        "additionalProperties": false,
        "properties": {
          "task": {
            "type": "string",
            "maxLength": 100,
            "enum": ["Profile", "U4 Filing", "CE Tasks", "Attestation", "Exam Schedule", "Disclosure Letter"],
            "description": "Name of the task category that failed"
          },
          "source": {
            "type": "string",
            "maxLength": 100,
            "enum": ["DOWNSTREAM_UNAVAILABLE"],
            "description": "Error source classification"
          },
          "message": {
            "type": "string",
            "maxLength": 500,
            "description": "User-facing error message in the format '{task} is temporarily unavailable, please try again later or contact support'. Specific downstream details are logged server-side only."
          }
        }
      }
    }
  }
}
