{
  "typeName" : "AWS::Connect::User",
  "description" : "Resource Type definition for AWS::Connect::User",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-connect",
  "definitions" : {
    "FirstName" : {
      "description" : "The first name. This is required if you are using Amazon Connect or SAML for identity management.",
      "type" : "string"
    },
    "LastName" : {
      "description" : "The last name. This is required if you are using Amazon Connect or SAML for identity management.",
      "type" : "string"
    },
    "Email" : {
      "description" : "The email address. If you are using SAML for identity management and include this parameter, an error is returned.",
      "type" : "string"
    },
    "SecondaryEmail" : {
      "description" : "The secondary email address. If you provide a secondary email, the user receives email notifications -- other than password reset notifications -- to this email address instead of to their primary email address.",
      "type" : "string",
      "pattern" : "(?=^.{0,265}$)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,63}"
    },
    "Mobile" : {
      "description" : "The mobile phone number.",
      "type" : "string",
      "pattern" : "^\\+[1-9]\\d{1,14}$"
    },
    "SecurityProfileArn" : {
      "description" : "The identifier of the security profile for the user.",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:connect:[-a-z0-9]*:[0-9]{12}:instance/[-a-zA-Z0-9]*/security-profile/[-a-zA-Z0-9]*$"
    },
    "AfterContactWorkTimeLimit" : {
      "description" : "The After Call Work (ACW) timeout setting, in seconds.",
      "type" : "integer",
      "minimum" : 0
    },
    "AutoAccept" : {
      "description" : "The Auto accept setting.",
      "type" : "boolean"
    },
    "DeskPhoneNumber" : {
      "description" : "The phone number for the user's desk phone.",
      "type" : "string"
    },
    "PhoneType" : {
      "description" : "The phone type.",
      "type" : "string",
      "enum" : [ "SOFT_PHONE", "DESK_PHONE" ]
    },
    "PersistentConnection" : {
      "description" : "The Persistent Connection setting.",
      "type" : "boolean"
    },
    "VoiceEnhancementMode" : {
      "description" : "The Voice Enhancement Mode setting.",
      "type" : "string",
      "enum" : [ "NONE", "VOICE_ISOLATION", "NOISE_SUPPRESSION" ]
    },
    "UserIdentityInfo" : {
      "description" : "Contains information about the identity of a user.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "FirstName" : {
          "$ref" : "#/definitions/FirstName"
        },
        "LastName" : {
          "$ref" : "#/definitions/LastName"
        },
        "Email" : {
          "$ref" : "#/definitions/Email"
        },
        "SecondaryEmail" : {
          "$ref" : "#/definitions/SecondaryEmail"
        },
        "Mobile" : {
          "$ref" : "#/definitions/Mobile"
        }
      }
    },
    "UserPhoneConfig" : {
      "description" : "Contains information about the phone configuration settings for a user.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AfterContactWorkTimeLimit" : {
          "$ref" : "#/definitions/AfterContactWorkTimeLimit"
        },
        "AutoAccept" : {
          "$ref" : "#/definitions/AutoAccept"
        },
        "DeskPhoneNumber" : {
          "$ref" : "#/definitions/DeskPhoneNumber"
        },
        "PhoneType" : {
          "$ref" : "#/definitions/PhoneType"
        },
        "PersistentConnection" : {
          "$ref" : "#/definitions/PersistentConnection"
        }
      }
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "additionalProperties" : false,
      "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,
          "pattern" : "^(?!aws:)[a-zA-Z+-=._:/]+$"
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag. You can specify a value that is maximum of 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 -. ",
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ]
    },
    "UserProficiency" : {
      "description" : "Proficiency of a user.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AttributeName" : {
          "$ref" : "#/definitions/AttributeName"
        },
        "AttributeValue" : {
          "$ref" : "#/definitions/AttributeValue"
        },
        "Level" : {
          "$ref" : "#/definitions/Level"
        }
      },
      "required" : [ "AttributeName", "AttributeValue", "Level" ]
    },
    "AttributeName" : {
      "description" : "The name of user's proficiency. You must use name of predefined attribute present in the Amazon Connect instance.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 64
    },
    "AttributeValue" : {
      "description" : "The value of user's proficiency. You must use value of predefined attribute present in the Amazon Connect instance.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 64
    },
    "Level" : {
      "description" : "The level of the proficiency. The valid values are 1, 2, 3, 4 and 5.",
      "type" : "number",
      "minimum" : 1.0,
      "maximum" : 5.0
    },
    "AutoAcceptConfig" : {
      "description" : "Auto-accept configuration per channel.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Channel" : {
          "$ref" : "#/definitions/Channel"
        },
        "AutoAccept" : {
          "$ref" : "#/definitions/AutoAccept"
        },
        "AgentFirstCallbackAutoAccept" : {
          "$ref" : "#/definitions/AgentFirstCallbackAutoAccept"
        }
      },
      "required" : [ "Channel", "AutoAccept" ]
    },
    "Channel" : {
      "description" : "The channels that agents can handle in the Contact Control Panel (CCP).",
      "type" : "string",
      "enum" : [ "VOICE", "CHAT", "TASK", "EMAIL" ]
    },
    "AgentFirstCallbackAutoAccept" : {
      "description" : "The agent first callback auto accept setting.",
      "type" : "boolean"
    },
    "AfterContactWorkConfigPerChannel" : {
      "description" : "After Contact Work configuration per channel.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Channel" : {
          "$ref" : "#/definitions/Channel"
        },
        "AfterContactWorkConfig" : {
          "$ref" : "#/definitions/AfterContactWorkConfig"
        },
        "AgentFirstCallbackAfterContactWorkConfig" : {
          "$ref" : "#/definitions/AfterContactWorkConfig"
        }
      },
      "required" : [ "Channel", "AfterContactWorkConfig" ]
    },
    "AfterContactWorkConfig" : {
      "description" : "After Contact Work configuration.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AfterContactWorkTimeLimit" : {
          "$ref" : "#/definitions/AfterContactWorkTimeLimit"
        }
      }
    },
    "PhoneNumberConfig" : {
      "description" : "Phone Number configuration per channel.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Channel" : {
          "$ref" : "#/definitions/Channel"
        },
        "PhoneType" : {
          "$ref" : "#/definitions/PhoneType"
        },
        "PhoneNumber" : {
          "$ref" : "#/definitions/DeskPhoneNumber"
        }
      },
      "required" : [ "Channel", "PhoneType" ]
    },
    "PersistentConnectionConfig" : {
      "description" : "Persistent Connection configuration per channel.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Channel" : {
          "$ref" : "#/definitions/Channel"
        },
        "PersistentConnection" : {
          "$ref" : "#/definitions/PersistentConnection"
        }
      },
      "required" : [ "Channel", "PersistentConnection" ]
    },
    "VoiceEnhancementConfig" : {
      "description" : "Voice Enhancement configuration per channel.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Channel" : {
          "$ref" : "#/definitions/Channel"
        },
        "VoiceEnhancementMode" : {
          "$ref" : "#/definitions/VoiceEnhancementMode"
        }
      },
      "required" : [ "Channel", "VoiceEnhancementMode" ]
    }
  },
  "properties" : {
    "InstanceArn" : {
      "description" : "The identifier of the Amazon Connect instance.",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:connect:[-a-z0-9]*:[0-9]{12}:instance/[-a-zA-Z0-9]*$"
    },
    "DirectoryUserId" : {
      "description" : "The identifier of the user account in the directory used for identity management.",
      "type" : "string"
    },
    "HierarchyGroupArn" : {
      "description" : "The identifier of the hierarchy group for the user.",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:connect:[-a-z0-9]*:[0-9]{12}:instance/[-a-zA-Z0-9]*/agent-group/[-a-zA-Z0-9]*$"
    },
    "Username" : {
      "description" : "The user name for the account.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 64,
      "pattern" : "[a-zA-Z0-9\\_\\-\\.\\@]+"
    },
    "Password" : {
      "description" : "The password for the user account. A password is required if you are using Amazon Connect for identity management. Otherwise, it is an error to include a password.",
      "type" : "string",
      "pattern" : "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d\\S]{8,64}$"
    },
    "RoutingProfileArn" : {
      "description" : "The identifier of the routing profile for the user.",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:connect:[-a-z0-9]*:[0-9]{12}:instance/[-a-zA-Z0-9]*/routing-profile/[-a-zA-Z0-9]*$"
    },
    "IdentityInfo" : {
      "description" : "The information about the identity of the user.",
      "$ref" : "#/definitions/UserIdentityInfo"
    },
    "PhoneConfig" : {
      "description" : "The phone settings for the user.",
      "$ref" : "#/definitions/UserPhoneConfig"
    },
    "SecurityProfileArns" : {
      "type" : "array",
      "minItems" : 1,
      "maxItems" : 10,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "description" : "One or more security profile arns for the user",
      "items" : {
        "$ref" : "#/definitions/SecurityProfileArn"
      }
    },
    "UserArn" : {
      "description" : "The Amazon Resource Name (ARN) for the user.",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:connect:[-a-z0-9]*:[0-9]{12}:instance/[-a-zA-Z0-9]*/agent/[-a-zA-Z0-9]*$"
    },
    "Tags" : {
      "type" : "array",
      "maxItems" : 50,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "description" : "One or more tags.",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "UserProficiencies" : {
      "description" : "One or more predefined attributes assigned to a user, with a level that indicates how skilled they are.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/UserProficiency"
      }
    },
    "AutoAcceptConfigs" : {
      "description" : "Auto-accept configurations of a user.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/AutoAcceptConfig"
      }
    },
    "AfterContactWorkConfigs" : {
      "description" : "After Contact Work configurations of a user.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/AfterContactWorkConfigPerChannel"
      }
    },
    "PhoneNumberConfigs" : {
      "description" : "Phone Number configurations of a user.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/PhoneNumberConfig"
      }
    },
    "PersistentConnectionConfigs" : {
      "description" : "Persistent Connection configurations of a user.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/PersistentConnectionConfig"
      }
    },
    "VoiceEnhancementConfigs" : {
      "description" : "Voice Enhancement configurations of a user.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/VoiceEnhancementConfig"
      }
    }
  },
  "required" : [ "InstanceArn", "RoutingProfileArn", "SecurityProfileArns", "Username" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "connect:CreateUser", "connect:TagResource", "connect:AssociateUserProficiencies" ]
    },
    "read" : {
      "permissions" : [ "connect:DescribeUser", "connect:ListUserProficiencies" ]
    },
    "delete" : {
      "permissions" : [ "connect:DeleteUser", "connect:UntagResource" ]
    },
    "update" : {
      "permissions" : [ "connect:UpdateUserIdentityInfo", "connect:UpdateUserPhoneConfig", "connect:UpdateUserRoutingProfile", "connect:UpdateUserSecurityProfiles", "connect:UpdateUserHierarchy", "connect:TagResource", "connect:UntagResource", "connect:AssociateUserProficiencies", "connect:DisassociateUserProficiencies", "connect:UpdateUserProficiencies", "connect:UpdateUserConfig" ]
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "InstanceArn" : {
            "$ref" : "resource-schema.json#/properties/InstanceArn"
          }
        },
        "required" : [ "InstanceArn" ]
      },
      "permissions" : [ "connect:ListUsers" ]
    }
  },
  "additionalProperties" : false,
  "primaryIdentifier" : [ "/properties/UserArn" ],
  "readOnlyProperties" : [ "/properties/UserArn" ],
  "writeOnlyProperties" : [ "/properties/Password" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "connect:TagResource", "connect:UntagResource" ]
  }
}