{
 "additionalProperties": false,
 "allOf": [
  {
   "if": {
    "properties": {
     "LocalSecondaryIndexes": {
      "minItems": 1,
      "type": "array"
     }
    },
    "required": [
     "LocalSecondaryIndexes"
    ],
    "type": "object"
   },
   "then": {
    "properties": {
     "AttributeDefinitions": {
      "minItems": 2
     },
     "KeySchema": {
      "minItems": 2
     }
    },
    "type": "object"
   }
  }
 ],
 "conditionalCreateOnlyProperties": [
  "/properties/KeySchema"
 ],
 "createOnlyProperties": [
  "/properties/TableName",
  "/properties/ImportSourceSpecification"
 ],
 "definitions": {
  "AttributeDefinition": {
   "additionalProperties": false,
   "properties": {
    "AttributeName": {
     "maxLength": 255,
     "minLength": 1,
     "type": "string"
    },
    "AttributeType": {
     "enum": [
      "B",
      "N",
      "S"
     ],
     "type": "string"
    }
   },
   "required": [
    "AttributeName",
    "AttributeType"
   ],
   "type": "object"
  },
  "ContributorInsightsSpecification": {
   "additionalProperties": false,
   "properties": {
    "Enabled": {
     "type": "boolean"
    },
    "Mode": {
     "enum": [
      "ACCESSED_AND_THROTTLED_KEYS",
      "THROTTLED_KEYS"
     ],
     "type": "string"
    }
   },
   "required": [
    "Enabled"
   ],
   "type": "object"
  },
  "Csv": {
   "additionalProperties": false,
   "properties": {
    "Delimiter": {
     "type": "string"
    },
    "HeaderList": {
     "items": {
      "type": "string"
     },
     "type": "array",
     "uniqueItems": true
    }
   },
   "type": "object"
  },
  "DeprecatedHashKeyElement": {
   "additionalProperties": false,
   "properties": {
    "AttributeName": {
     "type": "string"
    },
    "AttributeType": {
     "type": "string"
    }
   },
   "required": [
    "AttributeType",
    "AttributeName"
   ],
   "type": "object"
  },
  "DeprecatedKeySchema": {
   "additionalProperties": false,
   "properties": {
    "HashKeyElement": {
     "$ref": "#/definitions/DeprecatedHashKeyElement"
    }
   },
   "required": [
    "HashKeyElement"
   ],
   "type": "object"
  },
  "GlobalSecondaryIndex": {
   "additionalProperties": false,
   "properties": {
    "ContributorInsightsSpecification": {
     "$ref": "#/definitions/ContributorInsightsSpecification"
    },
    "IndexName": {
     "type": "string"
    },
    "KeySchema": {
     "$ref": "#/definitions/KeySchema",
     "maxItems": 2,
     "minItems": 1
    },
    "OnDemandThroughput": {
     "$ref": "#/definitions/OnDemandThroughput"
    },
    "Projection": {
     "$ref": "#/definitions/Projection"
    },
    "ProvisionedThroughput": {
     "$ref": "#/definitions/ProvisionedThroughput"
    },
    "WarmThroughput": {
     "$ref": "#/definitions/WarmThroughput"
    }
   },
   "required": [
    "IndexName",
    "Projection",
    "KeySchema"
   ],
   "type": "object"
  },
  "ImportSourceSpecification": {
   "additionalProperties": false,
   "properties": {
    "InputCompressionType": {
     "type": "string"
    },
    "InputFormat": {
     "type": "string"
    },
    "InputFormatOptions": {
     "$ref": "#/definitions/InputFormatOptions"
    },
    "S3BucketSource": {
     "$ref": "#/definitions/S3BucketSource"
    }
   },
   "required": [
    "S3BucketSource",
    "InputFormat"
   ],
   "type": "object"
  },
  "InputFormatOptions": {
   "additionalProperties": false,
   "properties": {
    "Csv": {
     "$ref": "#/definitions/Csv"
    }
   },
   "type": "object"
  },
  "KeySchema": {
   "items": {
    "additionalProperties": false,
    "properties": {
     "AttributeName": {
      "type": "string"
     },
     "KeyType": {
      "type": "string"
     }
    },
    "required": [
     "KeyType",
     "AttributeName"
    ],
    "type": "object"
   },
   "prefixItems": [
    {
     "properties": {
      "KeyType": {
       "const": "HASH",
       "type": "string"
      }
     },
     "required": [
      "KeyType"
     ],
     "type": "object"
    },
    {
     "properties": {
      "KeyType": {
       "const": "RANGE",
       "type": "string"
      }
     },
     "required": [
      "KeyType"
     ],
     "type": "object"
    }
   ],
   "type": "array",
   "uniqueItems": true,
   "uniqueKeys": [
    "AttributeName"
   ]
  },
  "KinesisStreamSpecification": {
   "additionalProperties": false,
   "properties": {
    "ApproximateCreationDateTimePrecision": {
     "enum": [
      "MICROSECOND",
      "MILLISECOND"
     ],
     "type": "string"
    },
    "StreamArn": {
     "type": "string"
    }
   },
   "required": [
    "StreamArn"
   ],
   "type": "object"
  },
  "LocalSecondaryIndex": {
   "additionalProperties": false,
   "properties": {
    "IndexName": {
     "maxLength": 255,
     "minLength": 3,
     "pattern": "^[a-zA-Z0-9_.-]+$",
     "type": "string"
    },
    "KeySchema": {
     "$ref": "#/definitions/KeySchema",
     "maxItems": 2,
     "minItems": 2
    },
    "Projection": {
     "$ref": "#/definitions/Projection"
    }
   },
   "required": [
    "IndexName",
    "Projection",
    "KeySchema"
   ],
   "type": "object"
  },
  "OnDemandThroughput": {
   "additionalProperties": false,
   "properties": {
    "MaxReadRequestUnits": {
     "minimum": 1,
     "type": "integer"
    },
    "MaxWriteRequestUnits": {
     "minimum": 1,
     "type": "integer"
    }
   },
   "type": "object"
  },
  "PointInTimeRecoverySpecification": {
   "additionalProperties": false,
   "dependencies": {
    "RecoveryPeriodInDays": [
     "PointInTimeRecoveryEnabled"
    ]
   },
   "properties": {
    "PointInTimeRecoveryEnabled": {
     "type": "boolean"
    },
    "RecoveryPeriodInDays": {
     "maximum": 35,
     "minimum": 1,
     "type": "integer"
    }
   },
   "type": "object"
  },
  "Projection": {
   "additionalProperties": false,
   "properties": {
    "NonKeyAttributes": {
     "items": {
      "type": "string"
     },
     "type": "array",
     "uniqueItems": false
    },
    "ProjectionType": {
     "type": "string"
    }
   },
   "type": "object"
  },
  "ProvisionedThroughput": {
   "additionalProperties": false,
   "properties": {
    "ReadCapacityUnits": {
     "type": "integer"
    },
    "WriteCapacityUnits": {
     "type": "integer"
    }
   },
   "required": [
    "WriteCapacityUnits",
    "ReadCapacityUnits"
   ],
   "type": "object"
  },
  "ResourcePolicy": {
   "additionalProperties": false,
   "properties": {
    "PolicyDocument": {
     "format": "json",
     "type": [
      "object",
      "string"
     ]
    }
   },
   "required": [
    "PolicyDocument"
   ],
   "type": "object"
  },
  "S3BucketSource": {
   "additionalProperties": false,
   "properties": {
    "S3Bucket": {
     "type": "string"
    },
    "S3BucketOwner": {
     "type": "string"
    },
    "S3KeyPrefix": {
     "type": "string"
    }
   },
   "required": [
    "S3Bucket"
   ],
   "type": "object"
  },
  "SSESpecification": {
   "additionalProperties": false,
   "dependentRequired": {
    "KMSMasterKeyId": [
     "SSEType"
    ]
   },
   "properties": {
    "KMSMasterKeyId": {
     "anyOf": [
      {
       "relationshipRef": {
        "propertyPath": "/properties/Arn",
        "typeName": "AWS::KMS::Key"
       }
      },
      {
       "relationshipRef": {
        "propertyPath": "/properties/KeyId",
        "typeName": "AWS::KMS::Key"
       }
      },
      {
       "relationshipRef": {
        "propertyPath": "/properties/AliasName",
        "typeName": "AWS::KMS::Alias"
       }
      }
     ],
     "type": "string"
    },
    "SSEEnabled": {
     "type": "boolean"
    },
    "SSEType": {
     "enum": [
      "KMS"
     ],
     "type": "string"
    }
   },
   "required": [
    "SSEEnabled"
   ],
   "type": "object"
  },
  "StreamSpecification": {
   "additionalProperties": false,
   "properties": {
    "ResourcePolicy": {
     "$ref": "#/definitions/ResourcePolicy"
    },
    "StreamViewType": {
     "type": "string"
    }
   },
   "required": [
    "StreamViewType"
   ],
   "type": "object"
  },
  "Tag": {
   "additionalProperties": false,
   "properties": {
    "Key": {
     "type": "string"
    },
    "Value": {
     "type": "string"
    }
   },
   "required": [
    "Value",
    "Key"
   ],
   "type": "object"
  },
  "TimeToLiveSpecification": {
   "additionalProperties": false,
   "properties": {
    "AttributeName": {
     "type": "string"
    },
    "Enabled": {
     "type": "boolean"
    }
   },
   "required": [
    "Enabled"
   ],
   "type": "object"
  },
  "WarmThroughput": {
   "additionalProperties": false,
   "anyOf": [
    {
     "required": [
      "ReadUnitsPerSecond"
     ]
    },
    {
     "required": [
      "WriteUnitsPerSecond"
     ]
    }
   ],
   "properties": {
    "ReadUnitsPerSecond": {
     "minimum": 1,
     "type": "integer"
    },
    "WriteUnitsPerSecond": {
     "minimum": 1,
     "type": "integer"
    }
   },
   "type": "object"
  }
 },
 "primaryIdentifier": [
  "/properties/TableName"
 ],
 "properties": {
  "Arn": {
   "type": "string"
  },
  "AttributeDefinitions": {
   "items": {
    "$ref": "#/definitions/AttributeDefinition"
   },
   "type": "array",
   "uniqueItems": true,
   "uniqueKeys": [
    "AttributeName"
   ]
  },
  "BillingMode": {
   "type": "string"
  },
  "ContributorInsightsSpecification": {
   "$ref": "#/definitions/ContributorInsightsSpecification"
  },
  "DeletionProtectionEnabled": {
   "type": "boolean"
  },
  "GlobalSecondaryIndexes": {
   "items": {
    "$ref": "#/definitions/GlobalSecondaryIndex"
   },
   "type": "array",
   "uniqueItems": false
  },
  "ImportSourceSpecification": {
   "$ref": "#/definitions/ImportSourceSpecification"
  },
  "KeySchema": {
   "minItems": 1,
   "oneOf": [
    {
     "$ref": "#/definitions/KeySchema",
     "maxItems": 2,
     "minItems": 1
    },
    {
     "format": "json",
     "type": [
      "object",
      "string"
     ]
    }
   ]
  },
  "KinesisStreamSpecification": {
   "$ref": "#/definitions/KinesisStreamSpecification"
  },
  "LocalSecondaryIndexes": {
   "items": {
    "$ref": "#/definitions/LocalSecondaryIndex"
   },
   "type": "array",
   "uniqueItems": false
  },
  "OnDemandThroughput": {
   "$ref": "#/definitions/OnDemandThroughput"
  },
  "PointInTimeRecoverySpecification": {
   "$ref": "#/definitions/PointInTimeRecoverySpecification"
  },
  "ProvisionedThroughput": {
   "$ref": "#/definitions/ProvisionedThroughput"
  },
  "ResourcePolicy": {
   "$ref": "#/definitions/ResourcePolicy"
  },
  "SSESpecification": {
   "$ref": "#/definitions/SSESpecification"
  },
  "StreamArn": {
   "type": "string"
  },
  "StreamSpecification": {
   "$ref": "#/definitions/StreamSpecification"
  },
  "TableClass": {
   "type": "string"
  },
  "TableName": {
   "maxLength": 1024,
   "minLength": 1,
   "type": "string"
  },
  "Tags": {
   "items": {
    "$ref": "#/definitions/Tag"
   },
   "type": "array",
   "uniqueItems": false
  },
  "TimeToLiveSpecification": {
   "$ref": "#/definitions/TimeToLiveSpecification"
  },
  "WarmThroughput": {
   "$ref": "#/definitions/WarmThroughput"
  }
 },
 "propertyTransform": {
  "/properties/SSESpecification/KMSMasterKeyId": "$join([\"arn:aws(-[a-z]{1,4}){0,2}:kms:[a-z]{2,4}(-[a-z]{1,4})?-[a-z]{1,10}-[0-9]:[0-9]{12}:key\\/\", SSESpecification.KMSMasterKeyId]) $OR $join([\"arn:aws(-[a-z]{1,4}){0,2}:kms:[a-z]{2,4}(-[a-z]{1,4})?-[a-z]{1,10}-[0-9]:[0-9]{12}:key\\/\", KMSMasterKeyId])"
 },
 "readOnlyProperties": [
  "/properties/Arn",
  "/properties/StreamArn"
 ],
 "required": [
  "KeySchema"
 ],
 "tagging": {
  "cloudFormationSystemTags": false,
  "tagOnCreate": true,
  "tagProperty": "/properties/Tags",
  "tagUpdatable": true,
  "taggable": true
 },
 "typeName": "AWS::DynamoDB::Table",
 "writeOnlyProperties": [
  "/properties/ImportSourceSpecification"
 ]
}
