{
  "typeName" : "AWS::CustomerProfiles::ObjectType",
  "description" : "An ObjectType resource of Amazon Connect Customer Profiles",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-customer-profiles.git",
  "definitions" : {
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "pattern" : "^(?!aws:)[a-zA-Z+-=._:/]+$",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "additionalProperties" : false,
      "required" : [ "Key", "Value" ]
    },
    "FieldMap" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "pattern" : "^[a-zA-Z0-9_-]+$",
          "minLength" : 1,
          "maxLength" : 64
        },
        "ObjectTypeField" : {
          "$ref" : "#/definitions/ObjectTypeField"
        }
      },
      "additionalProperties" : false
    },
    "ObjectTypeField" : {
      "description" : "Represents a field in a ProfileObjectType.",
      "type" : "object",
      "properties" : {
        "Source" : {
          "description" : "A field of a ProfileObject. For example: _source.FirstName, where \"_source\" is a ProfileObjectType of a Zendesk user and \"FirstName\" is a field in that ObjectType.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 1000
        },
        "Target" : {
          "description" : "The location of the data in the standard ProfileObject model. For example: _profile.Address.PostalCode.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 1000
        },
        "ContentType" : {
          "description" : "The content type of the field. Used for determining equality when searching.",
          "type" : "string",
          "enum" : [ "STRING", "NUMBER", "PHONE_NUMBER", "EMAIL_ADDRESS", "NAME" ]
        }
      },
      "additionalProperties" : false
    },
    "KeyMap" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "pattern" : "^[a-zA-Z0-9_-]+$",
          "minLength" : 1,
          "maxLength" : 64
        },
        "ObjectTypeKeyList" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/ObjectTypeKey"
          }
        }
      },
      "additionalProperties" : false
    },
    "ObjectTypeKey" : {
      "description" : "An object that defines the Key element of a ProfileObject. A Key is a special element that can be used to search for a customer profile.",
      "type" : "object",
      "properties" : {
        "FieldNames" : {
          "description" : "The reference for the key name of the fields map. ",
          "type" : "array",
          "items" : {
            "type" : "string",
            "pattern" : "^[a-zA-Z0-9_-]+$",
            "minLength" : 1,
            "maxLength" : 64
          }
        },
        "StandardIdentifiers" : {
          "description" : "The types of keys that a ProfileObject can have. Each ProfileObject can have only 1 UNIQUE key but multiple PROFILE keys. PROFILE means that this key can be used to tie an object to a PROFILE. UNIQUE means that it can be used to uniquely identify an object. If a key a is marked as SECONDARY, it will be used to search for profiles after all other PROFILE keys have been searched. A LOOKUP_ONLY key is only used to match a profile but is not persisted to be used for searching of the profile. A NEW_ONLY key is only used if the profile does not already exist before the object is ingested, otherwise it is only used for matching objects to profiles.",
          "type" : "array",
          "items" : {
            "type" : "string",
            "enum" : [ "PROFILE", "UNIQUE", "SECONDARY", "LOOKUP_ONLY", "NEW_ONLY" ]
          }
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "DomainName" : {
      "description" : "The unique name of the domain.",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9_-]+$",
      "minLength" : 1,
      "maxLength" : 64
    },
    "ObjectTypeName" : {
      "description" : "The name of the profile object type.",
      "type" : "string",
      "pattern" : "^[a-zA-Z_][a-zA-Z_0-9-]*$",
      "minLength" : 1,
      "maxLength" : 255
    },
    "AllowProfileCreation" : {
      "description" : "Indicates whether a profile should be created when data is received.",
      "type" : "boolean"
    },
    "Description" : {
      "description" : "Description of the profile object type.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 1000
    },
    "EncryptionKey" : {
      "description" : "The default encryption key",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 255
    },
    "ExpirationDays" : {
      "description" : "The default number of days until the data within the domain expires.",
      "type" : "integer",
      "minimum" : 1,
      "maximum" : 1098
    },
    "Fields" : {
      "description" : "A list of the name and ObjectType field.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/FieldMap"
      }
    },
    "Keys" : {
      "description" : "A list of unique keys that can be used to map data to the profile.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/KeyMap"
      }
    },
    "CreatedAt" : {
      "description" : "The time of this integration got created.",
      "type" : "string"
    },
    "LastUpdatedAt" : {
      "description" : "The time of this integration got last updated at.",
      "type" : "string"
    },
    "Tags" : {
      "description" : "The tags (keys and values) associated with the integration.",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "minItems" : 0,
      "maxItems" : 50
    },
    "TemplateId" : {
      "description" : "A unique identifier for the object template.",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9_-]+$",
      "minLength" : 1,
      "maxLength" : 64
    }
  },
  "additionalProperties" : false,
  "required" : [ "DomainName" ],
  "createOnlyProperties" : [ "/properties/DomainName", "/properties/ObjectTypeName" ],
  "readOnlyProperties" : [ "/properties/LastUpdatedAt", "/properties/CreatedAt" ],
  "primaryIdentifier" : [ "/properties/DomainName", "/properties/ObjectTypeName" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "profile:GetProfileObjectType", "profile:PutProfileObjectType" ]
    },
    "read" : {
      "permissions" : [ "profile:GetProfileObjectType" ]
    },
    "update" : {
      "permissions" : [ "profile:GetProfileObjectType", "profile:PutProfileObjectType", "profile:UntagResource", "profile:TagResource" ]
    },
    "delete" : {
      "permissions" : [ "profile:DeleteProfileObjectType" ]
    },
    "list" : {
      "permissions" : [ "profile:ListProfileObjectTypes" ]
    }
  }
}