{
  "typeName" : "AWS::SMSVOICE::Pool",
  "description" : "Resource Type definition for AWS::SMSVOICE::Pool",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-smsvoice.git",
  "definitions" : {
    "MandatoryKeyword" : {
      "description" : "A keyword is a word that you can search for on a particular phone number or pool. It is also a specific word or phrase that an end user can send to your number to elicit a response, such as an informational message or a special offer. When your number receives a message that begins with a keyword, AWS End User Messaging SMS and Voice responds with a customizable message. Keywords \"HELP\" and \"STOP\" are mandatory keywords",
      "type" : "object",
      "properties" : {
        "Message" : {
          "type" : "string",
          "pattern" : "^(?!\\s*$)[\\s\\S]+$",
          "maxLength" : 1600
        }
      },
      "required" : [ "Message" ],
      "additionalProperties" : false
    },
    "OptionalKeyword" : {
      "description" : "A keyword is a word that you can search for on a particular phone number or pool. It is also a specific word or phrase that an end user can send to your number to elicit a response, such as an informational message or a special offer. When your number receives a message that begins with a keyword, AWS End User Messaging SMS and Voice responds with a customizable message.",
      "type" : "object",
      "properties" : {
        "Keyword" : {
          "type" : "string",
          "pattern" : "^(?!(?i)(stop|help)$)[ \\S]+",
          "maxLength" : 30
        },
        "Message" : {
          "type" : "string",
          "pattern" : "^(?!\\s*$)[\\s\\S]+$",
          "maxLength" : 1600
        },
        "Action" : {
          "type" : "string",
          "enum" : [ "AUTOMATIC_RESPONSE", "OPT_OUT", "OPT_IN" ]
        }
      },
      "required" : [ "Keyword", "Message", "Action" ],
      "additionalProperties" : false
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Arn" : {
      "type" : "string"
    },
    "PoolId" : {
      "type" : "string"
    },
    "OriginationIdentities" : {
      "description" : "The origination identity to use such as a PhoneNumberId, PhoneNumberArn, SenderId or SenderIdArn and it's IsoCountryCode.",
      "type" : "array",
      "items" : {
        "type" : "string",
        "pattern" : "^arn:\\S+",
        "minLength" : 20,
        "maxLength" : 256
      },
      "uniqueItems" : true,
      "insertionOrder" : false,
      "minItems" : 1
    },
    "DeletionProtectionEnabled" : {
      "description" : "When set to true the pool can't be deleted. By default this is set to false.",
      "type" : "boolean"
    },
    "OptOutListName" : {
      "description" : "The name of the OptOutList to associate with the pool. You can use the OptOutListName or OptOutListArn.",
      "type" : "string",
      "pattern" : "^[A-Za-z0-9_:/-]+$",
      "minLength" : 1,
      "maxLength" : 256
    },
    "SelfManagedOptOutsEnabled" : {
      "description" : "By default this is set to false. When an end recipient sends a message that begins with HELP or STOP to one of your dedicated numbers, AWS End User Messaging SMS and Voice automatically replies with a customizable message and adds the end recipient to the OptOutList. When set to true you're responsible for responding to HELP and STOP requests. You're also responsible for tracking and honoring opt-out requests.",
      "type" : "boolean"
    },
    "MandatoryKeywords" : {
      "description" : "A keyword is a word that you can search for on a particular phone number or pool. It is also a specific word or phrase that an end user can send to your number to elicit a response, such as an informational message or a special offer. When your number receives a message that begins with a keyword, AWS End User Messaging SMS and Voice responds with a customizable message. Keywords \"HELP\" and \"STOP\" are mandatory keywords",
      "type" : "object",
      "properties" : {
        "STOP" : {
          "$ref" : "#/definitions/MandatoryKeyword"
        },
        "HELP" : {
          "$ref" : "#/definitions/MandatoryKeyword"
        }
      },
      "required" : [ "STOP", "HELP" ],
      "additionalProperties" : false
    },
    "OptionalKeywords" : {
      "description" : "A keyword is a word that you can search for on a particular phone number or pool. It is also a specific word or phrase that an end user can send to your number to elicit a response, such as an informational message or a special offer. When your number receives a message that begins with a keyword, AWS End User Messaging SMS and Voice responds with a customizable message.",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/OptionalKeyword"
      },
      "uniqueItems" : true,
      "insertionOrder" : false
    },
    "SharedRoutesEnabled" : {
      "description" : "Indicates whether shared routes are enabled for the pool.",
      "type" : "boolean"
    },
    "TwoWay" : {
      "description" : "When you set up two-way SMS, you can receive incoming messages from your customers. When one of your customers sends a message to your phone number, the message body is sent to an Amazon SNS topic or Amazon Connect for processing.",
      "type" : "object",
      "properties" : {
        "Enabled" : {
          "description" : "By default this is set to false. When set to true you can receive incoming text messages from your end recipients.",
          "type" : "boolean"
        },
        "ChannelArn" : {
          "description" : "The Amazon Resource Name (ARN) of the two way channel.",
          "type" : "string",
          "pattern" : "^[ \\S]+"
        },
        "ChannelRole" : {
          "description" : "An optional IAM Role Arn for a service to assume, to be able to post inbound SMS messages.",
          "type" : "string",
          "pattern" : "^arn:\\S+$"
        }
      },
      "required" : [ "Enabled" ],
      "additionalProperties" : false
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this resource.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "OriginationIdentities", "MandatoryKeywords" ],
  "primaryIdentifier" : [ "/properties/PoolId" ],
  "readOnlyProperties" : [ "/properties/Arn", "/properties/PoolId" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "sms-voice:UntagResource", "sms-voice:TagResource", "sms-voice:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "sms-voice:DescribePools", "sms-voice:CreatePool", "sms-voice:UpdatePool", "sms-voice:AssociateOriginationIdentity", "sms-voice:ListPoolOriginationIdentities", "sms-voice:PutKeyword", "sms-voice:TagResource", "sms-voice:ListTagsForResource", "sms-voice:DescribePhoneNumbers", "sms-voice:DescribeKeywords", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "sms-voice:DescribePools", "sms-voice:ListPoolOriginationIdentities", "sms-voice:DescribeKeywords", "sms-voice:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "sms-voice:DescribePools", "sms-voice:UpdatePool", "sms-voice:DisassociateOriginationIdentity", "sms-voice:AssociateOriginationIdentity", "sms-voice:ListPoolOriginationIdentities", "sms-voice:DeleteKeyword", "sms-voice:DescribeKeywords", "sms-voice:PutKeyword", "sms-voice:UntagResource", "sms-voice:TagResource", "sms-voice:ListTagsForResource", "sms-voice:DescribePhoneNumbers", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "sms-voice:ListPoolOriginationIdentities", "sms-voice:DisassociateOriginationIdentity", "sms-voice:DeletePool", "sms-voice:DescribePools" ]
    },
    "list" : {
      "permissions" : [ "sms-voice:DescribePools" ]
    }
  }
}