{
  "resourceType": "StructureDefinition",
  "id": "User",
  "url": "http://hl7.org/fhir/StructureDefinition/User",
  "version": "0.1",
  "name": "User",
  "status": "draft",
  "publisher": "Synapxe",
  "copyright": "Copyright (C) 2024 Synapxe",
  "fhirVersion": "5.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "User",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DomainResource",
  "derivation": "specialization",
  "differential": {
    "element": [
      {
        "id": "User",
        "path": "User",
        "constraint": [
          {
            "key": "dom-3",
            "severity": "error",
            "human": "If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource",
            "expression": "contained.where(((id.exists() and ('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url)))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(uri) = '#').exists()).not()).trace('unmatched', id).empty()"
          },
          {
            "key": "email-format",
            "severity": "error",
            "human": "If system is 'email', the value must be a valid email address.",
            "expression": "email.matches('^\\\\S+@\\\\S+\\\\.\\\\S{2,}$')"
          }
        ]
      },
      {
        "id": "User.name",
        "path": "User.name",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.email",
        "path": "User.email",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.status",
        "path": "User.status",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false,
        "binding": {
          "strength": "required",
          "valueSet": "https://fhir.synapxe.sg/ValueSet/user-status"
        }
      },
      {
        "id": "User.location",
        "path": "User.location",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.lastLoginOn",
        "path": "User.lastLoginOn",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "BackboneElement"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.preference",
        "path": "User.preference",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.preferredRole",
        "path": "User.preferredRole",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Role"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.role",
        "path": "User.role",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Role"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.createdBy",
        "path": "User.createdBy",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.creationDateTime",
        "path": "User.creationDateTime",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "BackboneElement"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.modifiedBy",
        "path": "User.modifiedBy",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.isDeleted",
        "path": "User.isDeleted",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "boolean"
          }
        ],
        "isModifier": false
      },
      {
        "id": "User.modificationDateTime",
        "path": "User.modificationDateTime",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "BackboneElement"
          }
        ],
        "isModifier": false
      }
    ]
  }
}