{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api-evangelist.com/schemas/amazon/dynamodb/table.json",
  "title": "Amazon DynamoDB Table",
  "description": "Represents an Amazon DynamoDB table with its associated configuration, key schema, throughput settings, indexes, and metadata.",
  "type": "object",
  "required": ["tableName", "keySchema", "attributeDefinitions"],
  "properties": {
    "tableName": {
      "type": "string",
      "description": "The name of the table",
      "minLength": 3,
      "maxLength": 255,
      "pattern": "^[a-zA-Z0-9._-]+$"
    },
    "tableArn": {
      "type": "string",
      "description": "The Amazon Resource Name (ARN) that uniquely identifies the table",
      "pattern": "^arn:aws:dynamodb:.+:\\d{12}:table/.+$"
    },
    "tableId": {
      "type": "string",
      "description": "Unique identifier for the table",
      "pattern": "^[a-f0-9-]{36}$"
    },
    "tableStatus": {
      "type": "string",
      "description": "The current state of the table",
      "enum": ["CREATING", "UPDATING", "DELETING", "ACTIVE", "INACCESSIBLE_ENCRYPTION_CREDENTIALS", "ARCHIVING", "ARCHIVED"]
    },
    "creationDateTime": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time when the table was created"
    },
    "keySchema": {
      "type": "array",
      "description": "The primary key structure for the table, consisting of one or two key elements",
      "items": {
        "$ref": "#/$defs/KeySchemaElement"
      },
      "minItems": 1,
      "maxItems": 2
    },
    "attributeDefinitions": {
      "type": "array",
      "description": "An array of attributes that describe the key schema for the table and indexes",
      "items": {
        "$ref": "#/$defs/AttributeDefinition"
      }
    },
    "provisionedThroughput": {
      "$ref": "#/$defs/ProvisionedThroughput"
    },
    "billingMode": {
      "type": "string",
      "description": "Controls how you are charged for read and write throughput",
      "enum": ["PROVISIONED", "PAY_PER_REQUEST"]
    },
    "itemCount": {
      "type": "integer",
      "description": "The number of items in the table (updated approximately every six hours)",
      "minimum": 0
    },
    "tableSizeBytes": {
      "type": "integer",
      "description": "The total size of the table in bytes (updated approximately every six hours)",
      "minimum": 0
    },
    "globalSecondaryIndexes": {
      "type": "array",
      "description": "The global secondary indexes, if any, on the table",
      "items": {
        "$ref": "#/$defs/GlobalSecondaryIndex"
      }
    },
    "localSecondaryIndexes": {
      "type": "array",
      "description": "The local secondary indexes, if any, on the table",
      "items": {
        "$ref": "#/$defs/LocalSecondaryIndex"
      }
    },
    "streamSpecification": {
      "$ref": "#/$defs/StreamSpecification"
    },
    "sseDescription": {
      "$ref": "#/$defs/SSEDescription"
    },
    "tags": {
      "type": "array",
      "description": "Tags assigned to the table",
      "items": {
        "$ref": "#/$defs/Tag"
      }
    }
  },
  "$defs": {
    "KeySchemaElement": {
      "type": "object",
      "description": "Represents a single element of a key schema, specifying the attribute name and its role",
      "required": ["attributeName", "keyType"],
      "properties": {
        "attributeName": {
          "type": "string",
          "description": "The name of a key attribute"
        },
        "keyType": {
          "type": "string",
          "description": "The role that this key attribute will assume (HASH for partition key, RANGE for sort key)",
          "enum": ["HASH", "RANGE"]
        }
      }
    },
    "AttributeDefinition": {
      "type": "object",
      "description": "Represents an attribute for describing the key schema for the table and indexes",
      "required": ["attributeName", "attributeType"],
      "properties": {
        "attributeName": {
          "type": "string",
          "description": "A name for the attribute"
        },
        "attributeType": {
          "type": "string",
          "description": "The data type for the attribute (S=String, N=Number, B=Binary)",
          "enum": ["S", "N", "B"]
        }
      }
    },
    "ProvisionedThroughput": {
      "type": "object",
      "description": "Represents the provisioned throughput settings for the table",
      "properties": {
        "readCapacityUnits": {
          "type": "integer",
          "description": "The maximum number of strongly consistent reads consumed per second",
          "minimum": 1
        },
        "writeCapacityUnits": {
          "type": "integer",
          "description": "The maximum number of writes consumed per second",
          "minimum": 1
        },
        "lastIncreaseDateTime": {
          "type": "string",
          "format": "date-time",
          "description": "The date and time of the last provisioned throughput increase"
        },
        "lastDecreaseDateTime": {
          "type": "string",
          "format": "date-time",
          "description": "The date and time of the last provisioned throughput decrease"
        },
        "numberOfDecreasesToday": {
          "type": "integer",
          "description": "The number of provisioned throughput decreases for this table during this UTC calendar day",
          "minimum": 0
        }
      }
    },
    "GlobalSecondaryIndex": {
      "type": "object",
      "description": "Represents the properties of a global secondary index",
      "required": ["indexName", "keySchema", "projection"],
      "properties": {
        "indexName": {
          "type": "string",
          "description": "The name of the global secondary index",
          "minLength": 3,
          "maxLength": 255
        },
        "keySchema": {
          "type": "array",
          "description": "The complete key schema for the global secondary index",
          "items": {
            "$ref": "#/$defs/KeySchemaElement"
          },
          "minItems": 1,
          "maxItems": 2
        },
        "projection": {
          "$ref": "#/$defs/Projection"
        },
        "indexStatus": {
          "type": "string",
          "description": "The current state of the global secondary index",
          "enum": ["CREATING", "UPDATING", "DELETING", "ACTIVE"]
        },
        "provisionedThroughput": {
          "$ref": "#/$defs/ProvisionedThroughput"
        },
        "indexSizeBytes": {
          "type": "integer",
          "description": "The total size of the index in bytes",
          "minimum": 0
        },
        "itemCount": {
          "type": "integer",
          "description": "The number of items in the index",
          "minimum": 0
        },
        "indexArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the index"
        }
      }
    },
    "LocalSecondaryIndex": {
      "type": "object",
      "description": "Represents the properties of a local secondary index",
      "required": ["indexName", "keySchema", "projection"],
      "properties": {
        "indexName": {
          "type": "string",
          "description": "The name of the local secondary index",
          "minLength": 3,
          "maxLength": 255
        },
        "keySchema": {
          "type": "array",
          "description": "The complete key schema for the local secondary index",
          "items": {
            "$ref": "#/$defs/KeySchemaElement"
          },
          "minItems": 2,
          "maxItems": 2
        },
        "projection": {
          "$ref": "#/$defs/Projection"
        },
        "indexSizeBytes": {
          "type": "integer",
          "description": "The total size of the index in bytes",
          "minimum": 0
        },
        "itemCount": {
          "type": "integer",
          "description": "The number of items in the index",
          "minimum": 0
        },
        "indexArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the index"
        }
      }
    },
    "Projection": {
      "type": "object",
      "description": "Represents attributes that are copied from the table into an index",
      "properties": {
        "projectionType": {
          "type": "string",
          "description": "The set of attributes that are projected into the index",
          "enum": ["ALL", "KEYS_ONLY", "INCLUDE"]
        },
        "nonKeyAttributes": {
          "type": "array",
          "description": "The non-key attributes that are projected into the index",
          "items": {
            "type": "string"
          },
          "maxItems": 20
        }
      }
    },
    "StreamSpecification": {
      "type": "object",
      "description": "Represents the DynamoDB Streams configuration for the table",
      "properties": {
        "streamEnabled": {
          "type": "boolean",
          "description": "Indicates whether DynamoDB Streams is enabled on the table"
        },
        "streamViewType": {
          "type": "string",
          "description": "Determines the information that is written to the stream",
          "enum": ["KEYS_ONLY", "NEW_IMAGE", "OLD_IMAGE", "NEW_AND_OLD_IMAGES"]
        }
      }
    },
    "SSEDescription": {
      "type": "object",
      "description": "The description of the server-side encryption status on the table",
      "properties": {
        "status": {
          "type": "string",
          "description": "The current state of server-side encryption",
          "enum": ["ENABLING", "ENABLED", "DISABLING", "DISABLED", "UPDATING"]
        },
        "sseType": {
          "type": "string",
          "description": "Server-side encryption type",
          "enum": ["AES256", "KMS"]
        },
        "kmsMasterKeyArn": {
          "type": "string",
          "description": "The ARN of the KMS key used for SSE-KMS encryption"
        }
      }
    },
    "Tag": {
      "type": "object",
      "description": "Describes a resource tag",
      "properties": {
        "key": {
          "type": "string",
          "description": "The key of the tag",
          "maxLength": 128
        },
        "value": {
          "type": "string",
          "description": "The value of the tag",
          "maxLength": 256
        }
      },
      "required": ["key"]
    }
  }
}
