{
  "$id": "https://schemas.opendd.eu/xtdrelationshiptosubject.1.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "xtd Relationship To Schema",
  "description": "xtdRelationshipToSubject is a specialization of xtdObject used to connect a subject to other subjects with a qualified relationship. The connection can be done within a specific context.",
  "allOf": [
    {
      "$ref": "/xtdroot.1.schema.json"
    },
    {
      "$ref": "/xtdobject.1.schema.json"
    },
    {
      "$ref": "#/$defs/RelationshipToSubject"
    }
  ],
  "$defs": {
    "RelationshipToSubject": {
      "type": "object",
      "properties": {
        "RelationshipType": {
          "title": "Relationship type",
          "description": "A relationship defined in the data dictionary used to connect the subject for a specific purpose.",
          "oneOf": [
            {
              "$ref": "/xtdrelationshiptype.1.schema.json"
            },
            {
              "$ref": "/opendd-entityref.1.schema.json"
            }
          ]
        },
        "TargetSubjects": {
          "title": "Target subjects",
          "description": "List of subjects connected with the relationship type.",
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "/xtdsubject.1.schema.json"
              },
              {
                "$ref": "/opendd-entityref.1.schema.json"
              }
            ]
          },
          "minItems": 1
        },
        "ScopeSubjects": {
          "title": "Scope subjects",
          "description": "Subject corresponding to the context in which the relationship is defined, scope of the relationship.; EXAMPLE A radiator (Subject) can be linked to a controller (TargetSubject) in the context of a heating system (ScopeSubject) by a ‘is driven by’ (RelationshipType) relationship.",
          "type": "array",
          "items": {
            "$ref": "/opendd-entityref.1.schema.json"
          },
          "minItems": 1
        }
      },
      "required": [
        "RelationshipType",
        "TargetSubjects"
      ]
    }
  }
}
