{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mzizi-dev/json-schema/mzizi-dev-data-layer-architecture-schema.json",
  "title": "DataLayerArchitecture",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mzizi-dev-openapi.yml#/components/schemas/DataLayerArchitecture",
  "type": "object",
  "required": [
    "@context",
    "@type",
    "name",
    "localDataLayer",
    "cloudLayer",
    "dataOwnership"
  ],
  "properties": {
    "@context": {
      "type": "string",
      "const": "https://schema.org"
    },
    "@type": {
      "type": "string",
      "const": "TechArticle"
    },
    "name": {
      "type": "string"
    },
    "localDataLayer": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DataLayerTechnology"
      }
    },
    "cloudLayer": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CloudService"
      }
    },
    "dataOwnership": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DataOwnershipRule"
      }
    }
  },
  "$defs": {
    "CloudService": {
      "type": "object",
      "required": [
        "name",
        "role",
        "consistencyModel",
        "database",
        "dataCategories",
        "description",
        "sovereignty"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "consistencyModel": {
          "type": "string",
          "enum": [
            "strict",
            "eventual"
          ]
        },
        "database": {
          "type": "string"
        },
        "dataCategories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "description": {
          "type": "string"
        },
        "sovereignty": {
          "$ref": "#/$defs/SovereigntyAssessment"
        }
      }
    },
    "DataLayerTechnology": {
      "type": "object",
      "required": [
        "name",
        "role",
        "platform",
        "description",
        "sovereignty"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "platform": {
          "type": "string",
          "enum": [
            "native",
            "browser",
            "both"
          ]
        },
        "description": {
          "type": "string"
        },
        "sovereignty": {
          "$ref": "#/$defs/SovereigntyAssessment"
        }
      }
    },
    "DataOwnershipRule": {
      "type": "object",
      "required": [
        "category",
        "consistencyModel",
        "database",
        "examples",
        "ownership",
        "description"
      ],
      "properties": {
        "category": {
          "type": "string"
        },
        "consistencyModel": {
          "type": "string",
          "enum": [
            "strict",
            "eventual",
            "aggregate"
          ]
        },
        "database": {
          "type": "string"
        },
        "conflictResolution": {
          "type": "string"
        },
        "ownership": {
          "type": "string",
          "enum": [
            "user-private",
            "community-shared",
            "public-open"
          ]
        },
        "description": {
          "type": "string"
        }
      }
    },
    "SovereigntyAssessment": {
      "type": "object",
      "required": [
        "technology",
        "role",
        "license",
        "governance",
        "sovereigntyRisk",
        "forkable",
        "selfHostable",
        "rationale"
      ],
      "properties": {
        "technology": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "license": {
          "type": "string"
        },
        "governance": {
          "type": "string"
        },
        "sovereigntyRisk": {
          "type": "string",
          "enum": [
            "none",
            "low",
            "removed"
          ]
        },
        "forkable": {
          "type": "boolean"
        },
        "selfHostable": {
          "type": "boolean"
        },
        "rationale": {
          "type": "string"
        }
      }
    }
  }
}