{
  "typeName" : "AWS::Wisdom::QuickResponse",
  "description" : "Definition of AWS::Wisdom::QuickResponse Resource Type.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-wisdom",
  "definitions" : {
    "ChannelType" : {
      "type" : "string",
      "enum" : [ "Chat", "Email" ]
    },
    "QuickResponseContentProvider" : {
      "description" : "The container of quick response content.",
      "type" : "object",
      "properties" : {
        "Content" : {
          "description" : "The content of the quick response.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 1024
        }
      },
      "additionalProperties" : false
    },
    "QuickResponseContents" : {
      "description" : "The content of the quick response stored in different media types.",
      "type" : "object",
      "properties" : {
        "Markdown" : {
          "$ref" : "#/definitions/QuickResponseContentProvider"
        },
        "PlainText" : {
          "$ref" : "#/definitions/QuickResponseContentProvider"
        }
      },
      "additionalProperties" : false
    },
    "GroupingConfiguration" : {
      "description" : "The configuration information of the user groups that the quick response is accessible to.",
      "type" : "object",
      "properties" : {
        "Criteria" : {
          "description" : "The criteria used for grouping Amazon Q in Connect users.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 100
        },
        "Values" : {
          "description" : "The list of values that define different groups of Amazon Q in Connect users.",
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/GroupingValue"
          },
          "insertionOrder" : true,
          "uniqueItems" : true
        }
      },
      "required" : [ "Criteria", "Values" ],
      "additionalProperties" : false
    },
    "GroupingValue" : {
      "description" : "The value that define the group of Amazon Q in Connect users.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 2048
    },
    "Status" : {
      "description" : "The status of the quick response data.",
      "type" : "string",
      "enum" : [ "CREATE_IN_PROGRESS", "CREATE_FAILED", "CREATED", "DELETE_IN_PROGRESS", "DELETE_FAILED", "DELETED", "UPDATE_IN_PROGRESS", "UPDATE_FAILED" ]
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "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 -",
          "type" : "string",
          "pattern" : "^(?!aws:)[a-zA-Z+-=._:/]+$",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "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 -",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "ContentType" : {
      "description" : "The media type of the quick response content.\n- Use application/x.quickresponse;format=plain for quick response written in plain text.\n- Use application/x.quickresponse;format=markdown for quick response written in richtext.",
      "type" : "string",
      "pattern" : "^(application/x\\.quickresponse;format=(plain|markdown))$"
    },
    "KnowledgeBaseArn" : {
      "description" : "The Amazon Resource Name (ARN) of the knowledge base.",
      "type" : "string",
      "pattern" : "^arn:[a-z-]*?:wisdom:[a-z0-9-]*?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}){0,2}$"
    },
    "Name" : {
      "description" : "The name of the quick response.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 100
    },
    "QuickResponseArn" : {
      "description" : "The Amazon Resource Name (ARN) of the quick response.",
      "type" : "string",
      "pattern" : "^arn:[a-z-]*?:wisdom:[a-z0-9-]*?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}){0,2}$"
    },
    "QuickResponseId" : {
      "description" : "The identifier of the quick response.",
      "type" : "string",
      "pattern" : "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
    },
    "Channels" : {
      "description" : "The Amazon Connect contact channels this quick response applies to.",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ChannelType"
      }
    },
    "Content" : {
      "$ref" : "#/definitions/QuickResponseContentProvider"
    },
    "Contents" : {
      "$ref" : "#/definitions/QuickResponseContents"
    },
    "Description" : {
      "description" : "The description of the quick response.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 255
    },
    "GroupingConfiguration" : {
      "$ref" : "#/definitions/GroupingConfiguration"
    },
    "IsActive" : {
      "description" : "Whether the quick response is active.",
      "type" : "boolean"
    },
    "Language" : {
      "description" : "The language code value for the language in which the quick response is written. The supported language codes include de_DE, en_US, es_ES, fr_FR, id_ID, it_IT, ja_JP, ko_KR, pt_BR, zh_CN, zh_TW",
      "type" : "string",
      "minLength" : 2,
      "maxLength" : 5
    },
    "ShortcutKey" : {
      "description" : "The shortcut key of the quick response. The value should be unique across the knowledge base.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 100
    },
    "Status" : {
      "$ref" : "#/definitions/Status"
    },
    "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" : [ "KnowledgeBaseArn", "Content", "Name" ],
  "readOnlyProperties" : [ "/properties/QuickResponseId", "/properties/QuickResponseArn", "/properties/Status", "/properties/Contents" ],
  "primaryIdentifier" : [ "/properties/QuickResponseArn" ],
  "createOnlyProperties" : [ "/properties/KnowledgeBaseArn" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "wisdom:TagResource", "wisdom:UntagResource" ]
  },
  "replacementStrategy" : "create_then_delete",
  "handlers" : {
    "create" : {
      "permissions" : [ "wisdom:CreateQuickResponse", "wisdom:GetQuickResponse", "wisdom:TagResource", "connect:SearchRoutingProfiles", "connect:DescribeRoutingProfile" ]
    },
    "update" : {
      "permissions" : [ "wisdom:UpdateQuickResponse", "wisdom:GetQuickResponse", "wisdom:TagResource", "wisdom:UntagResource", "connect:SearchRoutingProfiles", "connect:DescribeRoutingProfile" ]
    },
    "delete" : {
      "permissions" : [ "wisdom:DeleteQuickResponse", "wisdom:UntagResource" ]
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "KnowledgeBaseArn" : {
            "$ref" : "resource-schema.json#/properties/KnowledgeBaseArn"
          }
        },
        "required" : [ "KnowledgeBaseArn" ]
      },
      "permissions" : [ "wisdom:ListQuickResponses" ]
    },
    "read" : {
      "permissions" : [ "wisdom:GetQuickResponse" ]
    }
  }
}