{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "@context": [
    "https://schemas.meta-aiml.org/v3.0.0/context.jsonld"
  ],
  "@id": "https://schemas.meta-aiml.org/v3.0.0/entity/clinic.json",
  "$id": "https://schemas.meta-aiml.org/v3.0.0/entity/clinic.json",
  "@type": "Clinic",
  "schemaVersion": "3.0.0",
  "aimlVersion": "3.0.0",
  "title": "Clinic Entity Schema",
  "description": "v3 schema for outpatient clinics and ambulatory care providers delivering medical services directly to patients at controlled facilities with appointment and care coordination workflows.",
  "examples": [
    {
      "description": "Primary care clinic with scheduled appointments and digital intake forms",
      "reference": "clinic_example_primary_care"
    },
    {
      "description": "Specialty clinic with referral triage and on-site diagnostics support",
      "reference": "clinic_example_specialty_care"
    }
  ],
  "type": "object",
  "additionalProperties": false,
  "allOf": [
    {
      "$ref": "../ontology/physical_entity.json"
    },
    {
      "$ref": "../archetypes/direct_service.json"
    }
  ],
  "properties": {
    "@type": {
      "const": "Clinic"
    },
    "ontologicalMode": {
      "const": "PhysicalEntity"
    },
    "interactionArchetype": {
      "type": "array",
      "contains": {
        "const": "DirectService"
      },
      "items": {
        "type": "string",
        "enum": [
          "DirectService"
        ]
      }
    },
    "domain": {
      "const": "Healthcare"
    },
    "businessModel": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "InsuranceReimbursement",
          "Transactional",
          "Subscription"
        ]
      }
    },
    "deliveryFormat": {
      "type": "array",
      "contains": {
        "const": "PhysicalLocation"
      },
      "items": {
        "type": "string",
        "enum": [
          "PhysicalLocation",
          "WebApp",
          "MobileApp"
        ]
      }
    },
    "name": {
      "$ref": "../components/multilingual_format.json#/$defs/LocalizedText"
    },
    "description": {
      "$ref": "../components/multilingual_format.json#/$defs/LocalizedText"
    },
    "shortDescription": {
      "$ref": "../components/multilingual_format.json#/$defs/LocalizedTextOrString"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "foundingDate": {
      "type": "string",
      "format": "date"
    },
    "properties": {
      "type": "object",
      "properties": {
        "clinicType": {
          "type": "string",
          "enum": [
            "primary_care",
            "urgent_care",
            "specialty",
            "multi_specialty"
          ]
        },
        "supportsWalkIns": {
          "type": "boolean"
        },
        "supportsTeleconsultFollowUp": {
          "type": "boolean"
        },
        "specialties": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "acceptedAgeGroups": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "pediatric",
              "adult",
              "geriatric",
              "all_ages"
            ]
          }
        },
        "contactPoints": {
          "type": "array",
          "items": {
            "$ref": "../components/common_defs.json#/$defs/ContactPoint"
          }
        },
        "socialProfiles": {
          "type": "array",
          "items": {
            "$ref": "../components/common_defs.json#/$defs/SocialProfile"
          }
        },
        "identifiers": {
          "type": "array",
          "items": {
            "$ref": "../components/common_defs.json#/$defs/Identifier"
          }
        }
      }
    },
    "capabilities": {
      "type": "object",
      "required": [
        "interaction",
        "booking"
      ],
      "properties": {
        "interaction": {
          "$ref": "../components/capability_groups.json#/$defs/InteractionCapabilities"
        },
        "booking": {
          "$ref": "../components/capability_groups.json#/$defs/BookingCapabilities"
        },
        "financial": {
          "$ref": "../components/capability_groups.json#/$defs/FinancialCapabilities"
        },
        "content": {
          "$ref": "../components/capability_groups.json#/$defs/ContentCapabilities"
        },
        "location": {
          "$ref": "../components/capability_groups.json#/$defs/LocationCapabilities"
        }
      }
    },
    "modules": {
      "type": "object",
      "required": [
        "location"
      ],
      "properties": {
        "location": {
          "type": "object",
          "properties": {
            "address": {
              "$ref": "../components/address_format.json#/$defs/PostalAddress"
            },
            "geoCoordinates": {
              "$ref": "../components/address_format.json#/$defs/GeoCoordinates"
            },
            "parkingInfo": {
              "type": "string"
            }
          }
        },
        "appointments": {
          "type": "object",
          "properties": {
            "onlineSchedulingEnabled": {
              "type": "boolean"
            },
            "waitlistEnabled": {
              "type": "boolean"
            },
            "reminderChannels": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "sms",
                  "email",
                  "push"
                ]
              }
            }
          }
        },
        "records": {
          "type": "object",
          "properties": {
            "ehrIntegrationEnabled": {
              "type": "boolean"
            },
            "patientPortalEnabled": {
              "type": "boolean"
            },
            "consentWorkflowEnabled": {
              "type": "boolean"
            }
          }
        }
      }
    },
    "structuralMetadata": {
      "type": "object",
      "properties": {
        "topology": {
          "const": "binary"
        },
        "roles": {
          "const": [
            "user",
            "platform"
          ]
        },
        "valueSource": {
          "const": "platform_provided"
        },
        "transactionFlow": {
          "const": "direct"
        },
        "networkEffects": {
          "const": "none"
        },
        "careMode": {
          "type": "string",
          "enum": [
            "appointment_based",
            "walk_in",
            "hybrid"
          ]
        }
      }
    },
    "targetAudience": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "siteCapabilities": {
      "type": "object",
      "properties": {
        "supportedDevices": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "desktop",
              "mobile",
              "tablet"
            ]
          }
        },
        "languages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "accessibilityFeatures": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "required": [
    "@type",
    "ontologicalMode",
    "interactionArchetype",
    "domain",
    "name",
    "description",
    "deliveryFormat",
    "modules",
    "capabilities",
    "structuralMetadata"
  ],
  "validationMetadata": {
    "schemaVersion": "3.0.0",
    "phase": "entity",
    "status": "draft",
    "lastValidated": "2026-02-20T12:00:00Z",
    "validator": "META-AIML QA"
  },
  "semanticAnnotations": {
    "classificationRationale": "Clinic is modeled as PhysicalEntity + DirectService because treatment is delivered directly by the provider within physical care facilities.",
    "disambiguationNotes": "This schema is for care delivery organizations, not provider discovery marketplaces."
  },
  "governanceMetadata": {
    "entityVersion": "3.0.0",
    "introducedIn": "META-AIML v3.0.0",
    "stabilityLevel": "draft",
    "sdkValidationRules": [
      "RULE-CLIN-001: @type MUST equal \"Clinic\"",
      "RULE-CLIN-002: ontologicalMode MUST equal \"PhysicalEntity\"",
      "RULE-CLIN-003: interactionArchetype MUST contain \"DirectService\"",
      "RULE-CLIN-004: deliveryFormat MUST contain \"PhysicalLocation\"",
      "RULE-CLIN-005: modules.location MUST be present",
      "RULE-CLIN-006: capabilities.interaction MUST be present"
    ]
  }
}
