AWSTemplateFormatVersion: 2010-09-09
Description: DynamoDB Tables for mobile-notifications
Parameters:
  Stage:
    Description: Environment name
    Type: String
    AllowedValues:
      - CODE
      - PROD
Resources:
  mobileNotificationsReports:
    Type: 'AWS::DynamoDB::Table'
    Properties:
      TableName: !Sub 'mobile-notifications-reports-${Stage}'
      AttributeDefinitions:
        - AttributeName: sentTime
          AttributeType: S
        - AttributeName: id
          AttributeType: S
        - AttributeName: type
          AttributeType: S
      KeySchema:
        - AttributeName: id
          KeyType: HASH
      GlobalSecondaryIndexes:
        - IndexName: sentTime-index
          KeySchema:
            - AttributeName: type
              KeyType: HASH
            - AttributeName: sentTime
              KeyType: RANGE
          Projection:
            ProjectionType: ALL
      BillingMode: PAY_PER_REQUEST
      TimeToLiveSpecification:
        Enabled: true
        AttributeName: ttl
      StreamSpecification:
        StreamViewType: NEW_IMAGE
      Tags:
        - Key: devx-backup-enabled
          Value: true
