{
  "resourceType": "StructureDefinition",
  "id": "NPPRContactPoint",
  "url": "http://electronichealth.se/fhir/NPPR/StructureDefinition/NPPRContactPoint",
  "name": "NPPRContactPoint",
  "status": "active",
  "description": "Profile for expressing telecom details with valid value formats",
  "fhirVersion": "5.0.0",
  "kind": "complex-type",
  "abstract": false,
  "type": "ContactPoint",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/ContactPoint",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "ContactPoint",
        "path": "ContactPoint",
        "constraint": [
          {
            "key": "nppr-telecom-phone-1",
            "human": "If telecom.system = #phone, value should follow format +46123456789",
            "source": "http://electronichealth.se/fhir/NPPR/StructureDefinition/NPPRContactPoint",
            "severity": "warning",
            "expression": "value.matches('^\\\\+[1-9][0-9]+$') or system != 'phone'"
          },
          {
            "key": "nppr-telecom-url-1",
            "human": "If telecom.system = #url, value should follow valid format. Example: https://example.com",
            "source": "http://electronichealth.se/fhir/NPPR/StructureDefinition/NPPRContactPoint",
            "severity": "warning",
            "expression": "value.matches('(https?|ftp)://(-\\\\.)?([^\\\\s/?\\\\.#-]+\\\\.?)+(/[^\\\\s]*)?$') or system != 'url'"
          },
          {
            "key": "nppr-telecom-email-1",
            "human": "If telecom.system = #email, value should follow valid format Example: test@test.com",
            "source": "http://electronichealth.se/fhir/NPPR/StructureDefinition/NPPRContactPoint",
            "severity": "warning",
            "expression": "value.matches('^[\\\\w.-]{1,64}@(?!.{254})[\\\\w.-]+\\\\.[A-Za-z]{2,4}$') or system != 'email'"
          }
        ]
      },
      {
        "id": "ContactPoint.system",
        "path": "ContactPoint.system",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/ValueSet/contact-point-system"
        }
      },
      {
        "id": "ContactPoint.value",
        "path": "ContactPoint.value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ContactPoint.use",
        "path": "ContactPoint.use",
        "mustSupport": true
      },
      {
        "id": "ContactPoint.period",
        "path": "ContactPoint.period",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ContactPoint.period.start",
        "path": "ContactPoint.period.start",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ContactPoint.period.end",
        "path": "ContactPoint.period.end",
        "mustSupport": true
      }
    ]
  }
}