{
  "apiVersion": "forms.takoform.com/v1alpha1",
  "kind": "IndexedStore",
  "definitionVersion": "1.0.0",
  "title": "Indexed Store",
  "description": "Portable bounded key/value item store with declared queryable attributes and no query language.",
  "status": "standard",
  "desiredSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "indexedAttributes": {
        "items": {
          "pattern": "^[A-Za-z][A-Za-z0-9._:-]{0,127}$",
          "type": "string"
        },
        "type": "array",
        "uniqueItems": true
      },
      "name": {
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[a-z][a-z0-9-]{0,62}$",
        "type": "string"
      },
      "partitionKey": {
        "pattern": "^[A-Za-z][A-Za-z0-9._:-]{0,127}$",
        "type": "string"
      },
      "sortKey": {
        "pattern": "^[A-Za-z][A-Za-z0-9._:-]{0,127}$",
        "type": "string"
      }
    },
    "required": [
      "name",
      "partitionKey"
    ],
    "type": "object"
  },
  "observedSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "driftedFields": {
        "items": {
          "pattern": "^(?:/(?:[^~/]|~0|~1)*)+$",
          "type": "string"
        },
        "type": "array",
        "uniqueItems": true
      },
      "generation": {
        "maximum": 9223372036854775807,
        "minimum": 1,
        "type": "integer"
      },
      "id": {
        "pattern": "^IndexedStore/[a-z][a-z0-9-]{0,62}$",
        "type": "string"
      },
      "imported": {
        "type": "boolean"
      },
      "portability": {
        "pattern": "^[A-Za-z][A-Za-z0-9._:-]{0,127}$",
        "type": "string"
      },
      "ready": {
        "type": "boolean"
      }
    },
    "required": [
      "driftedFields",
      "generation",
      "id",
      "imported",
      "portability",
      "ready"
    ],
    "type": "object"
  },
  "outputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "generation": {
        "maximum": 9223372036854775807,
        "minimum": 1,
        "type": "integer"
      },
      "id": {
        "pattern": "^IndexedStore/[a-z][a-z0-9-]{0,62}$",
        "type": "string"
      },
      "kind": {
        "const": "IndexedStore",
        "type": "string"
      },
      "name": {
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[a-z][a-z0-9-]{0,62}$",
        "type": "string"
      },
      "portability": {
        "pattern": "^[A-Za-z][A-Za-z0-9._:-]{0,127}$",
        "type": "string"
      }
    },
    "required": [
      "generation",
      "id",
      "kind",
      "name",
      "portability"
    ],
    "type": "object"
  },
  "immutableFields": [
    "/name",
    "/partitionKey",
    "/sortKey"
  ],
  "lifecycleCapabilities": [
    "create",
    "read",
    "update",
    "delete",
    "import",
    "observe",
    "refresh",
    "drift"
  ],
  "interfaces": [
    {
      "name": "data.indexed",
      "version": "1",
      "description": "Portable bounded key and declared-index operations.",
      "required": true,
      "document": {
        "operations": [
          "delete",
          "get",
          "put",
          "query"
        ]
      },
      "documentSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "additionalProperties": false,
        "properties": {
          "operations": {
            "items": {
              "enum": [
                "delete",
                "get",
                "put",
                "query"
              ],
              "type": "string"
            },
            "maxItems": 4,
            "minItems": 4,
            "type": "array",
            "uniqueItems": true
          }
        },
        "required": [
          "operations"
        ],
        "type": "object"
      },
      "inputs": [
        {
          "name": "resource",
          "source": "output",
          "pointer": "/id"
        },
        {
          "name": "name",
          "source": "output",
          "pointer": "/name"
        }
      ]
    }
  ],
  "conformanceFixtures": [
    {
      "name": "canonical",
      "desiredPath": "fixtures/desired.json",
      "observedPath": "fixtures/observed.json",
      "outputPath": "fixtures/output.json"
    }
  ],
  "negativeConformanceFixtures": [
    {
      "name": "reject-missing-name",
      "stage": "desired",
      "inputPath": "fixtures/negative-missing-name.json",
      "expectedFailure": "schema_validation_failed"
    },
    {
      "name": "reject-missing-partition_key",
      "stage": "desired",
      "inputPath": "fixtures/negative-missing-partition_key.json",
      "expectedFailure": "schema_validation_failed"
    },
    {
      "name": "reject-partition_key",
      "stage": "desired",
      "inputPath": "fixtures/negative-partition_key.json",
      "expectedFailure": "schema_validation_failed"
    },
    {
      "name": "reject-sort_key",
      "stage": "desired",
      "inputPath": "fixtures/negative-sort_key.json",
      "expectedFailure": "schema_validation_failed"
    },
    {
      "name": "reject-indexed_attributes",
      "stage": "desired",
      "inputPath": "fixtures/negative-indexed_attributes.json",
      "expectedFailure": "schema_validation_failed"
    },
    {
      "name": "reject-observed-foreign-kind-id",
      "stage": "observed",
      "inputPath": "fixtures/negative-observed-foreign-kind-id.json",
      "expectedFailure": "schema_validation_failed"
    }
  ]
}
