{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/zywave/main/json-schema/zywave-agency-user-schema.json",
  "title": "AgencyUser",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zywave-agencies-v2-openapi.json#/components/schemas/AgencyUser",
  "allOf": [
    {
      "$ref": "#/$defs/AgencyUserInfo"
    },
    {
      "type": "object",
      "description": "Within the Zywave platform someone may have a number of user profiles tied to their login. When that user profile is associated with a tenant that is an agency within the Zywave platform that is called an agency user.",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "integer",
          "description": "The unique Zywave identifier for the user at the agency.",
          "format": "int32"
        },
        "agencyId": {
          "type": "integer",
          "description": "The ID for the agency associated with this user.",
          "format": "int32"
        },
        "createdDateTime": {
          "type": [
            "string",
            "null"
          ],
          "description": "The datetime in which an AgencyUser was created.",
          "format": "date-time"
        },
        "createdUserPrincipalId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The user principal Id of the user who created the new AgencyUser.",
          "format": "guid"
        },
        "updatedDateTime": {
          "type": [
            "string",
            "null"
          ],
          "description": "The datetime in which an AgencyUser was updated.",
          "format": "date-time"
        },
        "updatedUserPrincipalId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The user principal Id of the user who updated the new AgencyUser.",
          "format": "guid"
        }
      }
    }
  ],
  "$defs": {
    "AgencyUserInfo": {
      "type": "object",
      "description": "AgencyUserInfo represents the editable properties of an agency user.",
      "additionalProperties": false,
      "required": [
        "firstName",
        "lastName"
      ],
      "properties": {
        "biography": {
          "type": [
            "string",
            "null"
          ],
          "description": "A written biography about the user.",
          "maxLength": 1000
        },
        "designation": {
          "type": [
            "string",
            "null"
          ],
          "description": "A list of professional designations earned by the user.",
          "maxLength": 50
        },
        "emailAddress": {
          "type": [
            "string",
            "null"
          ],
          "description": "The primary emails address of the user.",
          "maxLength": 100
        },
        "externalEmployeeId": {
          "type": [
            "string",
            "null"
          ],
          "description": "An identifier for correlation with an external employee management system",
          "maxLength": 50
        },
        "faxNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "The primary fax number of the user.",
          "maxLength": 20
        },
        "firstName": {
          "type": "string",
          "description": "The first name of the user.",
          "maxLength": 50,
          "minLength": 1
        },
        "isAdministrator": {
          "type": "boolean",
          "description": "Denotes whether the user has full administrative privileges for the specific agency the are associated with."
        },
        "isEnabled": {
          "type": "boolean",
          "description": "Determine whether the user is an active user.  If the user is not active they will not have access to the Zywave platform for the specific agency they are associated with."
        },
        "lastName": {
          "type": "string",
          "description": "The last name of the user.",
          "maxLength": 50,
          "minLength": 1
        },
        "linesOfBusiness": {
          "type": "array",
          "description": "Specifies the lines of business within the agency the user is associated with.",
          "items": {
            "$ref": "#/$defs/LineOfBusiness"
          }
        },
        "middleInitial": {
          "type": [
            "string",
            "null"
          ],
          "description": "The middle initial of the user.",
          "maxLength": 2
        },
        "npn": {
          "type": [
            "string",
            "null"
          ],
          "description": "The national produce number for the user at this agency.",
          "maxLength": 10
        },
        "phoneNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "The primary phone number of the user.",
          "maxLength": 20
        },
        "primaryRole": {
          "description": "The primary role of the user at the agency.",
          "oneOf": [
            {
              "$ref": "#/$defs/AgencyUserRole"
            }
          ]
        },
        "salutation": {
          "type": [
            "string",
            "null"
          ],
          "description": "The greeting associated with the user.",
          "maxLength": 8
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "The job title of the user at the agency.",
          "maxLength": 100
        }
      }
    },
    "AgencyUserRole": {
      "type": "string",
      "description": "",
      "x-enumNames": [
        "None",
        "Executive",
        "Sales",
        "ClientServices",
        "InformationTechnology",
        "Finance",
        "HumanResources"
      ],
      "enum": [
        "None",
        "Executive",
        "Sales",
        "ClientServices",
        "InformationTechnology",
        "Finance",
        "HumanResources"
      ]
    },
    "LineOfBusiness": {
      "type": "string",
      "description": "",
      "x-enumNames": [
        "None",
        "Benefits",
        "Financial",
        "PersonalLines",
        "PropertyCasualty"
      ],
      "enum": [
        "None",
        "Benefits",
        "Financial",
        "PersonalLines",
        "PropertyCasualty"
      ]
    }
  }
}