{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://prism-framework.org/schema/1.0/prism-i/state",
  "title": "PRISM/I — S: State",
  "description": "Validates state/landscape.yaml. Captures databases, object storage, caches, data streams, and warehouses.",
  "type": "object",
  "required": ["prism_i", "artifacts"],
  "additionalProperties": false,
  "properties": {
    "prism_i": {
      "type": "object",
      "required": ["layer", "schema_version"],
      "additionalProperties": false,
      "properties": {
        "layer": { "const": "state" },
        "schema_version": { "type": "string", "pattern": "^\\d+\\.\\d+$" },
        "temporal_state": { "type": "string", "enum": ["baseline", "transition", "target"] },
        "as_of": { "type": "string", "format": "date" },
        "label": { "type": "string" }
      }
    },
    "artifacts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "name", "type", "ownership"],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9-]+$"
          },
          "name": { "type": "string" },
          "type": {
            "type": "string",
            "enum": [
              "database",
              "object_store",
              "file_system",
              "cache",
              "data_warehouse",
              "data_lake",
              "search_index",
              "backup"
            ],
            "description": "database — relational, document, graph, time-series, wide-column. object_store — S3/GCS/Azure Blob. file_system — EFS/NFS/distributed FS. cache — Redis/Memcached. data_warehouse — Snowflake/BigQuery/Redshift. data_lake — raw data repository. search_index — Elasticsearch/OpenSearch/Pinecone. backup — backup target or snapshot policy."
          },
          "ownership": {
            "type": "string",
            "enum": ["self", "internal", "external"]
          },
          "description": { "type": "string" },
          "status": {
            "type": "string",
            "enum": ["active", "deprecated", "planned", "decommissioning"]
          },
          "temporal_state": {
            "type": "string",
            "enum": ["baseline", "transition", "target"]
          },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "links": {
            "type": "object",
            "additionalProperties": { "type": "string" }
          },
          "notes": { "type": "string" },
          "data_sensitivity": {
            "type": "array",
            "items": { "type": "string", "enum": ["pii", "spii", "phi", "pci"] },
            "description": "Sensitivity classification of the data held in this store."
          },
          "compliance_frameworks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["framework"],
              "additionalProperties": false,
              "properties": {
                "framework": { "type": "string" },
                "scope": { "type": "string" },
                "status": {
                  "type": "string",
                  "enum": ["applicable", "certified", "in-progress", "exempt"]
                },
                "certification_date": { "type": "string", "format": "date" }
              }
            }
          },
          "engine": {
            "type": "string",
            "description": "Underlying database or storage engine (e.g., PostgreSQL, Redis, Snowflake)."
          },
          "version": { "type": "string" },
          "environment_id": {
            "type": "string",
            "description": "Reference to a where/environment artifact ID."
          },
          "region_id": {
            "type": "string",
            "description": "Reference to a where/region artifact ID."
          },
          "encryption_at_rest": {
            "type": "boolean",
            "description": "Whether data is encrypted at rest."
          },
          "multi_az": {
            "type": "boolean",
            "description": "Whether the store is deployed across multiple availability zones."
          },
          "backup_policy_id": {
            "type": "string",
            "description": "Reference to a backup artifact that covers this store."
          },
          "retention_days": {
            "type": "integer",
            "minimum": 1,
            "description": "Data retention period in days (where applicable)."
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "dimension"],
              "additionalProperties": false,
              "properties": {
                "id": { "type": "string" },
                "dimension": { "type": "string" }
              }
            }
          }
        }
      }
    }
  }
}
