//===----------------------------------------------------------------------===//
//
// This source file is part of the AWSSDKSwift open source project
//
// Copyright (c) 2017-2020 the AWSSDKSwift project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of AWSSDKSwift project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/swift-aws/aws-sdk-swift/blob/master/CodeGenerator/Sources/CodeGenerator/main.swift. DO NOT EDIT.

import AWSSDKSwiftCore
import Foundation

extension FraudDetector {
    //MARK: Enums

    public enum DataSource: String, CustomStringConvertible, Codable {
        case event = "EVENT"
        case modelScore = "MODEL_SCORE"
        case externalModelScore = "EXTERNAL_MODEL_SCORE"
        public var description: String { return self.rawValue }
    }

    public enum DataType: String, CustomStringConvertible, Codable {
        case string = "STRING"
        case integer = "INTEGER"
        case float = "FLOAT"
        case boolean = "BOOLEAN"
        public var description: String { return self.rawValue }
    }

    public enum DetectorVersionStatus: String, CustomStringConvertible, Codable {
        case draft = "DRAFT"
        case active = "ACTIVE"
        case inactive = "INACTIVE"
        public var description: String { return self.rawValue }
    }

    public enum Language: String, CustomStringConvertible, Codable {
        case detectorpl = "DETECTORPL"
        public var description: String { return self.rawValue }
    }

    public enum ModelEndpointStatus: String, CustomStringConvertible, Codable {
        case associated = "ASSOCIATED"
        case dissociated = "DISSOCIATED"
        public var description: String { return self.rawValue }
    }

    public enum ModelInputDataFormat: String, CustomStringConvertible, Codable {
        case textCsv = "TEXT_CSV"
        case applicationJson = "APPLICATION_JSON"
        public var description: String { return self.rawValue }
    }

    public enum ModelOutputDataFormat: String, CustomStringConvertible, Codable {
        case textCsv = "TEXT_CSV"
        case applicationJsonlines = "APPLICATION_JSONLINES"
        public var description: String { return self.rawValue }
    }

    public enum ModelSource: String, CustomStringConvertible, Codable {
        case sagemaker = "SAGEMAKER"
        public var description: String { return self.rawValue }
    }

    public enum ModelTypeEnum: String, CustomStringConvertible, Codable {
        case onlineFraudInsights = "ONLINE_FRAUD_INSIGHTS"
        public var description: String { return self.rawValue }
    }

    public enum ModelVersionStatus: String, CustomStringConvertible, Codable {
        case trainingInProgress = "TRAINING_IN_PROGRESS"
        case trainingComplete = "TRAINING_COMPLETE"
        case activateRequested = "ACTIVATE_REQUESTED"
        case activateInProgress = "ACTIVATE_IN_PROGRESS"
        case active = "ACTIVE"
        case inactivateInProgress = "INACTIVATE_IN_PROGRESS"
        case inactive = "INACTIVE"
        case error = "ERROR"
        public var description: String { return self.rawValue }
    }

    public enum RuleExecutionMode: String, CustomStringConvertible, Codable {
        case allMatched = "ALL_MATCHED"
        case firstMatched = "FIRST_MATCHED"
        public var description: String { return self.rawValue }
    }

    //MARK: Shapes

    public struct BatchCreateVariableError: AWSDecodableShape {

        /// The error code. 
        public let code: Int?
        /// The error message.
        public let message: String?
        /// The name.
        public let name: String?

        public init(code: Int? = nil, message: String? = nil, name: String? = nil) {
            self.code = code
            self.message = message
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case code = "code"
            case message = "message"
            case name = "name"
        }
    }

    public struct BatchCreateVariableRequest: AWSEncodableShape {

        /// The list of variables for the batch create variable request.
        public let variableEntries: [VariableEntry]

        public init(variableEntries: [VariableEntry]) {
            self.variableEntries = variableEntries
        }

        public func validate(name: String) throws {
            try validate(self.variableEntries, name: "variableEntries", parent: name, max: 25)
            try validate(self.variableEntries, name: "variableEntries", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case variableEntries = "variableEntries"
        }
    }

    public struct BatchCreateVariableResult: AWSDecodableShape {

        /// Provides the errors for the BatchCreateVariable request.
        public let errors: [BatchCreateVariableError]?

        public init(errors: [BatchCreateVariableError]? = nil) {
            self.errors = errors
        }

        private enum CodingKeys: String, CodingKey {
            case errors = "errors"
        }
    }

    public struct BatchGetVariableError: AWSDecodableShape {

        /// The error code. 
        public let code: Int?
        /// The error message.
        public let message: String?
        /// The error name. 
        public let name: String?

        public init(code: Int? = nil, message: String? = nil, name: String? = nil) {
            self.code = code
            self.message = message
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case code = "code"
            case message = "message"
            case name = "name"
        }
    }

    public struct BatchGetVariableRequest: AWSEncodableShape {

        /// The list of variable names to get.
        public let names: [String]

        public init(names: [String]) {
            self.names = names
        }

        public func validate(name: String) throws {
            try validate(self.names, name: "names", parent: name, max: 100)
            try validate(self.names, name: "names", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case names = "names"
        }
    }

    public struct BatchGetVariableResult: AWSDecodableShape {

        /// The errors from the request.
        public let errors: [BatchGetVariableError]?
        /// The returned variables.
        public let variables: [Variable]?

        public init(errors: [BatchGetVariableError]? = nil, variables: [Variable]? = nil) {
            self.errors = errors
            self.variables = variables
        }

        private enum CodingKeys: String, CodingKey {
            case errors = "errors"
            case variables = "variables"
        }
    }

    public struct CreateDetectorVersionRequest: AWSEncodableShape {

        /// The description of the detector version.
        public let description: String?
        /// The ID of the detector under which you want to create a new version.
        public let detectorId: String
        /// The Amazon Sagemaker model endpoints to include in the detector version.
        public let externalModelEndpoints: [String]?
        /// The model versions to include in the detector version.
        public let modelVersions: [ModelVersion]?
        /// The rule execution mode for the rules included in the detector version. You can define and edit the rule mode at the detector version level, when it is in draft status. If you specify FIRST_MATCHED, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule. If you specifiy ALL_MATCHED, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules.  The default behavior is FIRST_MATCHED.
        public let ruleExecutionMode: RuleExecutionMode?
        /// The rules to include in the detector version.
        public let rules: [Rule]

        public init(description: String? = nil, detectorId: String, externalModelEndpoints: [String]? = nil, modelVersions: [ModelVersion]? = nil, ruleExecutionMode: RuleExecutionMode? = nil, rules: [Rule]) {
            self.description = description
            self.detectorId = detectorId
            self.externalModelEndpoints = externalModelEndpoints
            self.modelVersions = modelVersions
            self.ruleExecutionMode = ruleExecutionMode
            self.rules = rules
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try self.modelVersions?.forEach {
                try $0.validate(name: "\(name).modelVersions[]")
            }
            try self.rules.forEach {
                try $0.validate(name: "\(name).rules[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case detectorId = "detectorId"
            case externalModelEndpoints = "externalModelEndpoints"
            case modelVersions = "modelVersions"
            case ruleExecutionMode = "ruleExecutionMode"
            case rules = "rules"
        }
    }

    public struct CreateDetectorVersionResult: AWSDecodableShape {

        /// The ID for the created version's parent detector.
        public let detectorId: String?
        /// The ID for the created detector. 
        public let detectorVersionId: String?
        /// The status of the detector version.
        public let status: DetectorVersionStatus?

        public init(detectorId: String? = nil, detectorVersionId: String? = nil, status: DetectorVersionStatus? = nil) {
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
            case status = "status"
        }
    }

    public struct CreateModelVersionRequest: AWSEncodableShape {

        /// The model version description.
        public let description: String?
        /// The model ID. 
        public let modelId: String
        /// The model type.
        public let modelType: ModelTypeEnum

        public init(description: String? = nil, modelId: String, modelType: ModelTypeEnum) {
            self.description = description
            self.modelId = modelId
            self.modelType = modelType
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case modelId = "modelId"
            case modelType = "modelType"
        }
    }

    public struct CreateModelVersionResult: AWSDecodableShape {

        /// The model ID. 
        public let modelId: String?
        /// The model type.
        public let modelType: ModelTypeEnum?
        /// The version of the model. 
        public let modelVersionNumber: String?
        /// The model version status. 
        public let status: String?

        public init(modelId: String? = nil, modelType: ModelTypeEnum? = nil, modelVersionNumber: String? = nil, status: String? = nil) {
            self.modelId = modelId
            self.modelType = modelType
            self.modelVersionNumber = modelVersionNumber
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVersionNumber = "modelVersionNumber"
            case status = "status"
        }
    }

    public struct CreateRuleRequest: AWSEncodableShape {

        /// The rule description.
        public let description: String?
        /// The detector ID for the rule's parent detector.
        public let detectorId: String
        /// The rule expression.
        public let expression: String
        /// The language of the rule.
        public let language: Language
        /// The outcome or outcomes returned when the rule expression matches.
        public let outcomes: [String]
        /// The rule ID.
        public let ruleId: String

        public init(description: String? = nil, detectorId: String, expression: String, language: Language, outcomes: [String], ruleId: String) {
            self.description = description
            self.detectorId = detectorId
            self.expression = expression
            self.language = language
            self.outcomes = outcomes
            self.ruleId = ruleId
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.expression, name: "expression", parent: name, max: 4096)
            try validate(self.expression, name: "expression", parent: name, min: 1)
            try validate(self.outcomes, name: "outcomes", parent: name, min: 1)
            try validate(self.ruleId, name: "ruleId", parent: name, max: 64)
            try validate(self.ruleId, name: "ruleId", parent: name, min: 1)
            try validate(self.ruleId, name: "ruleId", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case detectorId = "detectorId"
            case expression = "expression"
            case language = "language"
            case outcomes = "outcomes"
            case ruleId = "ruleId"
        }
    }

    public struct CreateRuleResult: AWSDecodableShape {

        /// The created rule.
        public let rule: Rule?

        public init(rule: Rule? = nil) {
            self.rule = rule
        }

        private enum CodingKeys: String, CodingKey {
            case rule = "rule"
        }
    }

    public struct CreateVariableRequest: AWSEncodableShape {

        /// The source of the data.
        public let dataSource: DataSource
        /// The data type.
        public let dataType: DataType
        /// The default value for the variable when no value is received.
        public let defaultValue: String
        /// The description.
        public let description: String?
        /// The name of the variable.
        public let name: String
        /// The variable type.
        public let variableType: String?

        public init(dataSource: DataSource, dataType: DataType, defaultValue: String, description: String? = nil, name: String, variableType: String? = nil) {
            self.dataSource = dataSource
            self.dataType = dataType
            self.defaultValue = defaultValue
            self.description = description
            self.name = name
            self.variableType = variableType
        }

        private enum CodingKeys: String, CodingKey {
            case dataSource = "dataSource"
            case dataType = "dataType"
            case defaultValue = "defaultValue"
            case description = "description"
            case name = "name"
            case variableType = "variableType"
        }
    }

    public struct CreateVariableResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct DeleteDetectorRequest: AWSEncodableShape {

        /// The ID of the detector to delete.
        public let detectorId: String

        public init(detectorId: String) {
            self.detectorId = detectorId
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
        }
    }

    public struct DeleteDetectorResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct DeleteDetectorVersionRequest: AWSEncodableShape {

        /// The ID of the parent detector for the detector version to delete.
        public let detectorId: String
        /// The ID of the detector version to delete.
        public let detectorVersionId: String

        public init(detectorId: String, detectorVersionId: String) {
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.detectorVersionId, name: "detectorVersionId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
        }
    }

    public struct DeleteDetectorVersionResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct DeleteEventRequest: AWSEncodableShape {

        /// The ID of the event to delete.
        public let eventId: String

        public init(eventId: String) {
            self.eventId = eventId
        }

        private enum CodingKeys: String, CodingKey {
            case eventId = "eventId"
        }
    }

    public struct DeleteEventResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct DeleteRuleVersionRequest: AWSEncodableShape {

        /// The ID of the detector that includes the rule version to delete.
        public let detectorId: String
        /// The rule ID of the rule version to delete.
        public let ruleId: String
        /// The rule version to delete.
        public let ruleVersion: String

        public init(detectorId: String, ruleId: String, ruleVersion: String) {
            self.detectorId = detectorId
            self.ruleId = ruleId
            self.ruleVersion = ruleVersion
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.ruleId, name: "ruleId", parent: name, max: 64)
            try validate(self.ruleId, name: "ruleId", parent: name, min: 1)
            try validate(self.ruleId, name: "ruleId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.ruleVersion, name: "ruleVersion", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case ruleId = "ruleId"
            case ruleVersion = "ruleVersion"
        }
    }

    public struct DeleteRuleVersionResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct DescribeDetectorRequest: AWSEncodableShape {

        /// The detector ID.
        public let detectorId: String
        /// The maximum number of results to return for the request.
        public let maxResults: Int?
        /// The next token from the previous response.
        public let nextToken: String?

        public init(detectorId: String, maxResults: Int? = nil, nextToken: String? = nil) {
            self.detectorId = detectorId
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.maxResults, name: "maxResults", parent: name, max: 2500)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 1000)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case maxResults = "maxResults"
            case nextToken = "nextToken"
        }
    }

    public struct DescribeDetectorResult: AWSDecodableShape {

        /// The detector ID.
        public let detectorId: String?
        /// The status and description for each detector version.
        public let detectorVersionSummaries: [DetectorVersionSummary]?
        /// The next token to be used for subsequent requests.
        public let nextToken: String?

        public init(detectorId: String? = nil, detectorVersionSummaries: [DetectorVersionSummary]? = nil, nextToken: String? = nil) {
            self.detectorId = detectorId
            self.detectorVersionSummaries = detectorVersionSummaries
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case detectorVersionSummaries = "detectorVersionSummaries"
            case nextToken = "nextToken"
        }
    }

    public struct DescribeModelVersionsRequest: AWSEncodableShape {

        /// The maximum number of results to return.
        public let maxResults: Int?
        /// The model ID.
        public let modelId: String?
        /// The model type.
        public let modelType: ModelTypeEnum?
        /// The model version. 
        public let modelVersionNumber: String?
        /// The next token from the previous results.
        public let nextToken: String?

        public init(maxResults: Int? = nil, modelId: String? = nil, modelType: ModelTypeEnum? = nil, modelVersionNumber: String? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.modelId = modelId
            self.modelType = modelType
            self.modelVersionNumber = modelVersionNumber
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.maxResults, name: "maxResults", parent: name, max: 10)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.modelVersionNumber, name: "modelVersionNumber", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "maxResults"
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVersionNumber = "modelVersionNumber"
            case nextToken = "nextToken"
        }
    }

    public struct DescribeModelVersionsResult: AWSDecodableShape {

        /// The model version details.
        public let modelVersionDetails: [ModelVersionDetail]?
        /// The next token.
        public let nextToken: String?

        public init(modelVersionDetails: [ModelVersionDetail]? = nil, nextToken: String? = nil) {
            self.modelVersionDetails = modelVersionDetails
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case modelVersionDetails = "modelVersionDetails"
            case nextToken = "nextToken"
        }
    }

    public struct Detector: AWSDecodableShape {

        /// Timestamp of when the detector was created.
        public let createdTime: String?
        /// The detector description.
        public let description: String?
        /// The detector ID.
        public let detectorId: String?
        /// Timestamp of when the detector was last updated.
        public let lastUpdatedTime: String?

        public init(createdTime: String? = nil, description: String? = nil, detectorId: String? = nil, lastUpdatedTime: String? = nil) {
            self.createdTime = createdTime
            self.description = description
            self.detectorId = detectorId
            self.lastUpdatedTime = lastUpdatedTime
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case description = "description"
            case detectorId = "detectorId"
            case lastUpdatedTime = "lastUpdatedTime"
        }
    }

    public struct DetectorVersionSummary: AWSDecodableShape {

        /// The detector version description. 
        public let description: String?
        /// The detector version ID. 
        public let detectorVersionId: String?
        /// Timestamp of when the detector version was last updated.
        public let lastUpdatedTime: String?
        /// The detector version status. 
        public let status: DetectorVersionStatus?

        public init(description: String? = nil, detectorVersionId: String? = nil, lastUpdatedTime: String? = nil, status: DetectorVersionStatus? = nil) {
            self.description = description
            self.detectorVersionId = detectorVersionId
            self.lastUpdatedTime = lastUpdatedTime
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case detectorVersionId = "detectorVersionId"
            case lastUpdatedTime = "lastUpdatedTime"
            case status = "status"
        }
    }

    public struct ExternalModel: AWSDecodableShape {

        /// Timestamp of when the model was last created.
        public let createdTime: String?
        /// The input configuration.
        public let inputConfiguration: ModelInputConfiguration?
        /// Timestamp of when the model was last updated.
        public let lastUpdatedTime: String?
        /// The Amazon SageMaker model endpoints.
        public let modelEndpoint: String?
        /// The Amazon Fraud Detector status for the external model endpoint
        public let modelEndpointStatus: ModelEndpointStatus?
        /// The source of the model.
        public let modelSource: ModelSource?
        /// The output configuration.
        public let outputConfiguration: ModelOutputConfiguration?
        /// The role used to invoke the model. 
        public let role: Role?

        public init(createdTime: String? = nil, inputConfiguration: ModelInputConfiguration? = nil, lastUpdatedTime: String? = nil, modelEndpoint: String? = nil, modelEndpointStatus: ModelEndpointStatus? = nil, modelSource: ModelSource? = nil, outputConfiguration: ModelOutputConfiguration? = nil, role: Role? = nil) {
            self.createdTime = createdTime
            self.inputConfiguration = inputConfiguration
            self.lastUpdatedTime = lastUpdatedTime
            self.modelEndpoint = modelEndpoint
            self.modelEndpointStatus = modelEndpointStatus
            self.modelSource = modelSource
            self.outputConfiguration = outputConfiguration
            self.role = role
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case inputConfiguration = "inputConfiguration"
            case lastUpdatedTime = "lastUpdatedTime"
            case modelEndpoint = "modelEndpoint"
            case modelEndpointStatus = "modelEndpointStatus"
            case modelSource = "modelSource"
            case outputConfiguration = "outputConfiguration"
            case role = "role"
        }
    }

    public struct GetDetectorVersionRequest: AWSEncodableShape {

        /// The detector ID.
        public let detectorId: String
        /// The detector version ID.
        public let detectorVersionId: String

        public init(detectorId: String, detectorVersionId: String) {
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.detectorVersionId, name: "detectorVersionId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
        }
    }

    public struct GetDetectorVersionResult: AWSDecodableShape {

        /// The timestamp when the detector version was created. 
        public let createdTime: String?
        /// The detector version description.
        public let description: String?
        /// The detector ID.
        public let detectorId: String?
        /// The detector version ID.
        public let detectorVersionId: String?
        /// The Amazon SageMaker model endpoints included in the detector version.
        public let externalModelEndpoints: [String]?
        /// The timestamp when the detector version was last updated. 
        public let lastUpdatedTime: String?
        /// The model versions included in the detector version. 
        public let modelVersions: [ModelVersion]?
        /// The execution mode of the rule in the dectector  FIRST_MATCHED indicates that Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.  ALL_MATCHED indicates that Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules. You can define and edit the rule mode at the detector version level, when it is in draft status.
        public let ruleExecutionMode: RuleExecutionMode?
        /// The rules included in the detector version.
        public let rules: [Rule]?
        /// The status of the detector version.
        public let status: DetectorVersionStatus?

        public init(createdTime: String? = nil, description: String? = nil, detectorId: String? = nil, detectorVersionId: String? = nil, externalModelEndpoints: [String]? = nil, lastUpdatedTime: String? = nil, modelVersions: [ModelVersion]? = nil, ruleExecutionMode: RuleExecutionMode? = nil, rules: [Rule]? = nil, status: DetectorVersionStatus? = nil) {
            self.createdTime = createdTime
            self.description = description
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
            self.externalModelEndpoints = externalModelEndpoints
            self.lastUpdatedTime = lastUpdatedTime
            self.modelVersions = modelVersions
            self.ruleExecutionMode = ruleExecutionMode
            self.rules = rules
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case description = "description"
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
            case externalModelEndpoints = "externalModelEndpoints"
            case lastUpdatedTime = "lastUpdatedTime"
            case modelVersions = "modelVersions"
            case ruleExecutionMode = "ruleExecutionMode"
            case rules = "rules"
            case status = "status"
        }
    }

    public struct GetDetectorsRequest: AWSEncodableShape {

        /// The detector ID.
        public let detectorId: String?
        /// The maximum number of objects to return for the request.
        public let maxResults: Int?
        /// The next token for the subsequent request.
        public let nextToken: String?

        public init(detectorId: String? = nil, maxResults: Int? = nil, nextToken: String? = nil) {
            self.detectorId = detectorId
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.maxResults, name: "maxResults", parent: name, max: 10)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 5)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case maxResults = "maxResults"
            case nextToken = "nextToken"
        }
    }

    public struct GetDetectorsResult: AWSDecodableShape {

        /// The detectors.
        public let detectors: [Detector]?
        /// The next page token.
        public let nextToken: String?

        public init(detectors: [Detector]? = nil, nextToken: String? = nil) {
            self.detectors = detectors
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case detectors = "detectors"
            case nextToken = "nextToken"
        }
    }

    public struct GetExternalModelsRequest: AWSEncodableShape {

        /// The maximum number of objects to return for the request.
        public let maxResults: Int?
        /// The Amazon SageMaker model endpoint.
        public let modelEndpoint: String?
        /// The next page token for the request.
        public let nextToken: String?

        public init(maxResults: Int? = nil, modelEndpoint: String? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.modelEndpoint = modelEndpoint
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.maxResults, name: "maxResults", parent: name, max: 10)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 5)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "maxResults"
            case modelEndpoint = "modelEndpoint"
            case nextToken = "nextToken"
        }
    }

    public struct GetExternalModelsResult: AWSDecodableShape {

        /// Gets the Amazon SageMaker models.
        public let externalModels: [ExternalModel]?
        /// The next page token to be used in subsequent requests.
        public let nextToken: String?

        public init(externalModels: [ExternalModel]? = nil, nextToken: String? = nil) {
            self.externalModels = externalModels
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case externalModels = "externalModels"
            case nextToken = "nextToken"
        }
    }

    public struct GetModelVersionRequest: AWSEncodableShape {

        /// The model ID. 
        public let modelId: String
        /// The model type. 
        public let modelType: ModelTypeEnum
        /// The model version. 
        public let modelVersionNumber: String

        public init(modelId: String, modelType: ModelTypeEnum, modelVersionNumber: String) {
            self.modelId = modelId
            self.modelType = modelType
            self.modelVersionNumber = modelVersionNumber
        }

        public func validate(name: String) throws {
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.modelVersionNumber, name: "modelVersionNumber", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVersionNumber = "modelVersionNumber"
        }
    }

    public struct GetModelVersionResult: AWSDecodableShape {

        /// The model version description.
        public let description: String?
        /// The model ID. 
        public let modelId: String?
        /// The model type. 
        public let modelType: ModelTypeEnum?
        /// The model version. 
        public let modelVersionNumber: String?
        /// The model version status. 
        public let status: String?

        public init(description: String? = nil, modelId: String? = nil, modelType: ModelTypeEnum? = nil, modelVersionNumber: String? = nil, status: String? = nil) {
            self.description = description
            self.modelId = modelId
            self.modelType = modelType
            self.modelVersionNumber = modelVersionNumber
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVersionNumber = "modelVersionNumber"
            case status = "status"
        }
    }

    public struct GetModelsRequest: AWSEncodableShape {

        /// The maximum results to return for the request.
        public let maxResults: Int?
        /// The model ID.
        public let modelId: String?
        /// The model type.
        public let modelType: ModelTypeEnum?
        /// The next token for the request.
        public let nextToken: String?

        public init(maxResults: Int? = nil, modelId: String? = nil, modelType: ModelTypeEnum? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.modelId = modelId
            self.modelType = modelType
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.maxResults, name: "maxResults", parent: name, max: 10)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "maxResults"
            case modelId = "modelId"
            case modelType = "modelType"
            case nextToken = "nextToken"
        }
    }

    public struct GetModelsResult: AWSDecodableShape {

        /// The returned models. 
        public let models: [Model]?
        /// The next token for subsequent requests. 
        public let nextToken: String?

        public init(models: [Model]? = nil, nextToken: String? = nil) {
            self.models = models
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case models = "models"
            case nextToken = "nextToken"
        }
    }

    public struct GetOutcomesRequest: AWSEncodableShape {

        /// The maximum number of objects to return for the request. 
        public let maxResults: Int?
        /// The name of the outcome or outcomes to get.
        public let name: String?
        /// The next page token for the request. 
        public let nextToken: String?

        public init(maxResults: Int? = nil, name: String? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.name = name
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 50)
            try validate(self.name, name: "name", parent: name, max: 64)
            try validate(self.name, name: "name", parent: name, min: 1)
            try validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "maxResults"
            case name = "name"
            case nextToken = "nextToken"
        }
    }

    public struct GetOutcomesResult: AWSDecodableShape {

        /// The next page token for subsequent requests.
        public let nextToken: String?
        /// The outcomes. 
        public let outcomes: [Outcome]?

        public init(nextToken: String? = nil, outcomes: [Outcome]? = nil) {
            self.nextToken = nextToken
            self.outcomes = outcomes
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "nextToken"
            case outcomes = "outcomes"
        }
    }

    public struct GetPredictionRequest: AWSEncodableShape {

        /// The detector ID. 
        public let detectorId: String
        /// The detector version ID.
        public let detectorVersionId: String?
        /// Names of variables you defined in Amazon Fraud Detector to represent event data elements and their corresponding values for the event you are sending for evaluation.
        public let eventAttributes: [String: String]?
        /// The unique ID used to identify the event.
        public let eventId: String
        /// The Amazon SageMaker model endpoint input data blobs.
        public let externalModelEndpointDataBlobs: [String: ModelEndpointDataBlob]?

        public init(detectorId: String, detectorVersionId: String? = nil, eventAttributes: [String: String]? = nil, eventId: String, externalModelEndpointDataBlobs: [String: ModelEndpointDataBlob]? = nil) {
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
            self.eventAttributes = eventAttributes
            self.eventId = eventId
            self.externalModelEndpointDataBlobs = externalModelEndpointDataBlobs
        }

        public func validate(name: String) throws {
            try self.eventAttributes?.forEach {
                try validate($0.key, name: "eventAttributes.key", parent: name, max: 64)
                try validate($0.key, name: "eventAttributes.key", parent: name, min: 1)
                try validate($0.value, name: "eventAttributes[\"\($0.key)\"]", parent: name, max: 256)
                try validate($0.value, name: "eventAttributes[\"\($0.key)\"]", parent: name, min: 1)
            }
            try self.externalModelEndpointDataBlobs?.forEach {
                try $0.value.validate(name: "\(name).externalModelEndpointDataBlobs[\"\($0.key)\"]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
            case eventAttributes = "eventAttributes"
            case eventId = "eventId"
            case externalModelEndpointDataBlobs = "externalModelEndpointDataBlobs"
        }
    }

    public struct GetPredictionResult: AWSDecodableShape {

        /// The model scores for models used in the detector version.
        public let modelScores: [ModelScores]?
        /// The prediction outcomes.
        public let outcomes: [String]?
        /// The rule results in the prediction.
        public let ruleResults: [RuleResult]?

        public init(modelScores: [ModelScores]? = nil, outcomes: [String]? = nil, ruleResults: [RuleResult]? = nil) {
            self.modelScores = modelScores
            self.outcomes = outcomes
            self.ruleResults = ruleResults
        }

        private enum CodingKeys: String, CodingKey {
            case modelScores = "modelScores"
            case outcomes = "outcomes"
            case ruleResults = "ruleResults"
        }
    }

    public struct GetRulesRequest: AWSEncodableShape {

        /// The detector ID.
        public let detectorId: String
        /// The maximum number of rules to return for the request.
        public let maxResults: Int?
        /// The next page token.
        public let nextToken: String?
        /// The rule ID.
        public let ruleId: String?
        /// The rule version.
        public let ruleVersion: String?

        public init(detectorId: String, maxResults: Int? = nil, nextToken: String? = nil, ruleId: String? = nil, ruleVersion: String? = nil) {
            self.detectorId = detectorId
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.ruleId = ruleId
            self.ruleVersion = ruleVersion
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 50)
            try validate(self.ruleId, name: "ruleId", parent: name, max: 64)
            try validate(self.ruleId, name: "ruleId", parent: name, min: 1)
            try validate(self.ruleId, name: "ruleId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.ruleVersion, name: "ruleVersion", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case maxResults = "maxResults"
            case nextToken = "nextToken"
            case ruleId = "ruleId"
            case ruleVersion = "ruleVersion"
        }
    }

    public struct GetRulesResult: AWSDecodableShape {

        /// The next page token to be used in subsequent requests.
        public let nextToken: String?
        /// The details of the requested rule.
        public let ruleDetails: [RuleDetail]?

        public init(nextToken: String? = nil, ruleDetails: [RuleDetail]? = nil) {
            self.nextToken = nextToken
            self.ruleDetails = ruleDetails
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "nextToken"
            case ruleDetails = "ruleDetails"
        }
    }

    public struct GetVariablesRequest: AWSEncodableShape {

        /// The max size per page determined for the get variable request. 
        public let maxResults: Int?
        /// The name of the variable. 
        public let name: String?
        /// The next page token of the get variable request. 
        public let nextToken: String?

        public init(maxResults: Int? = nil, name: String? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.name = name
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try validate(self.maxResults, name: "maxResults", parent: name, min: 50)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "maxResults"
            case name = "name"
            case nextToken = "nextToken"
        }
    }

    public struct GetVariablesResult: AWSDecodableShape {

        /// The next page token to be used in subsequent requests. 
        public let nextToken: String?
        /// The names of the variables returned. 
        public let variables: [Variable]?

        public init(nextToken: String? = nil, variables: [Variable]? = nil) {
            self.nextToken = nextToken
            self.variables = variables
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "nextToken"
            case variables = "variables"
        }
    }

    public struct LabelSchema: AWSEncodableShape & AWSDecodableShape {

        /// The label key.
        public let labelKey: String
        /// The label mapper maps the Amazon Fraud Detector supported label to the appropriate source labels. For example, if "FRAUD" and "LEGIT" are Amazon Fraud Detector supported labels, this mapper could be: {"FRAUD" =&gt; ["0"], "LEGIT" =&gt; ["1"]} or {"FRAUD" =&gt; ["false"], "LEGIT" =&gt; ["true"]} or {"FRAUD" =&gt; ["fraud", "abuse"], "LEGIT" =&gt; ["legit", "safe"]}. The value part of the mapper is a list, because you may have multiple variants for a single Amazon Fraud Detector label. 
        public let labelMapper: [String: [String]]

        public init(labelKey: String, labelMapper: [String: [String]]) {
            self.labelKey = labelKey
            self.labelMapper = labelMapper
        }

        private enum CodingKeys: String, CodingKey {
            case labelKey = "labelKey"
            case labelMapper = "labelMapper"
        }
    }

    public struct Model: AWSDecodableShape {

        /// Timestamp of when the model was created.
        public let createdTime: String?
        /// The model description.
        public let description: String?
        /// The model label schema.
        public let labelSchema: LabelSchema?
        /// Timestamp of last time the model was updated.
        public let lastUpdatedTime: String?
        /// The model ID.
        public let modelId: String?
        /// The model type.
        public let modelType: ModelTypeEnum?
        /// The model input variables.
        public let modelVariables: [ModelVariable]?
        /// The model training data source in Amazon S3.
        public let trainingDataSource: TrainingDataSource?

        public init(createdTime: String? = nil, description: String? = nil, labelSchema: LabelSchema? = nil, lastUpdatedTime: String? = nil, modelId: String? = nil, modelType: ModelTypeEnum? = nil, modelVariables: [ModelVariable]? = nil, trainingDataSource: TrainingDataSource? = nil) {
            self.createdTime = createdTime
            self.description = description
            self.labelSchema = labelSchema
            self.lastUpdatedTime = lastUpdatedTime
            self.modelId = modelId
            self.modelType = modelType
            self.modelVariables = modelVariables
            self.trainingDataSource = trainingDataSource
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case description = "description"
            case labelSchema = "labelSchema"
            case lastUpdatedTime = "lastUpdatedTime"
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVariables = "modelVariables"
            case trainingDataSource = "trainingDataSource"
        }
    }

    public struct ModelEndpointDataBlob: AWSEncodableShape {

        /// The byte buffer of the Amazon SageMaker model endpoint input data blob.
        public let byteBuffer: Data?
        /// The content type of the Amazon SageMaker model endpoint input data blob. 
        public let contentType: String?

        public init(byteBuffer: Data? = nil, contentType: String? = nil) {
            self.byteBuffer = byteBuffer
            self.contentType = contentType
        }

        public func validate(name: String) throws {
            try validate(self.contentType, name: "contentType", parent: name, max: 1024)
            try validate(self.contentType, name: "contentType", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case byteBuffer = "byteBuffer"
            case contentType = "contentType"
        }
    }

    public struct ModelInputConfiguration: AWSEncodableShape & AWSDecodableShape {

        ///  Template for constructing the CSV input-data sent to SageMaker. At event-evaluation, the placeholders for variable-names in the template will be replaced with the variable values before being sent to SageMaker. 
        public let csvInputTemplate: String?
        ///  The format of the model input configuration. The format differs depending on if it is passed through to SageMaker or constructed by Amazon Fraud Detector.
        public let format: ModelInputDataFormat?
        ///  For an opaque-model, the input to the model will be a ByteBuffer blob provided in the getPrediction request, and will be passed to SageMaker as-is. For non-opaque models, the input will be constructed by Amazon Fraud Detector based on the model-configuration. 
        public let isOpaque: Bool
        ///  Template for constructing the JSON input-data sent to SageMaker. At event-evaluation, the placeholders for variable names in the template will be replaced with the variable values before being sent to SageMaker. 
        public let jsonInputTemplate: String?

        public init(csvInputTemplate: String? = nil, format: ModelInputDataFormat? = nil, isOpaque: Bool, jsonInputTemplate: String? = nil) {
            self.csvInputTemplate = csvInputTemplate
            self.format = format
            self.isOpaque = isOpaque
            self.jsonInputTemplate = jsonInputTemplate
        }

        private enum CodingKeys: String, CodingKey {
            case csvInputTemplate = "csvInputTemplate"
            case format = "format"
            case isOpaque = "isOpaque"
            case jsonInputTemplate = "jsonInputTemplate"
        }
    }

    public struct ModelOutputConfiguration: AWSEncodableShape & AWSDecodableShape {

        /// A map of CSV index values in the SageMaker response to the Amazon Fraud Detector variables. 
        public let csvIndexToVariableMap: [String: String]?
        /// The format of the model output configuration.
        public let format: ModelOutputDataFormat
        /// A map of JSON keys in response from SageMaker to the Amazon Fraud Detector variables. 
        public let jsonKeyToVariableMap: [String: String]?

        public init(csvIndexToVariableMap: [String: String]? = nil, format: ModelOutputDataFormat, jsonKeyToVariableMap: [String: String]? = nil) {
            self.csvIndexToVariableMap = csvIndexToVariableMap
            self.format = format
            self.jsonKeyToVariableMap = jsonKeyToVariableMap
        }

        private enum CodingKeys: String, CodingKey {
            case csvIndexToVariableMap = "csvIndexToVariableMap"
            case format = "format"
            case jsonKeyToVariableMap = "jsonKeyToVariableMap"
        }
    }

    public struct ModelScores: AWSDecodableShape {

        /// The model version.
        public let modelVersion: ModelVersion?
        /// The model's fraud prediction scores.
        public let scores: [String: Float]?

        public init(modelVersion: ModelVersion? = nil, scores: [String: Float]? = nil) {
            self.modelVersion = modelVersion
            self.scores = scores
        }

        private enum CodingKeys: String, CodingKey {
            case modelVersion = "modelVersion"
            case scores = "scores"
        }
    }

    public struct ModelVariable: AWSEncodableShape & AWSDecodableShape {

        /// The model variable's index.&gt;
        public let index: Int?
        /// The model variable's name.&gt;
        public let name: String

        public init(index: Int? = nil, name: String) {
            self.index = index
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case index = "index"
            case name = "name"
        }
    }

    public struct ModelVersion: AWSEncodableShape & AWSDecodableShape {

        /// The parent model ID.
        public let modelId: String
        /// The model type.
        public let modelType: ModelTypeEnum
        /// The model version.
        public let modelVersionNumber: String

        public init(modelId: String, modelType: ModelTypeEnum, modelVersionNumber: String) {
            self.modelId = modelId
            self.modelType = modelType
            self.modelVersionNumber = modelVersionNumber
        }

        public func validate(name: String) throws {
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.modelVersionNumber, name: "modelVersionNumber", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVersionNumber = "modelVersionNumber"
        }
    }

    public struct ModelVersionDetail: AWSDecodableShape {

        /// The timestamp when the model was created.
        public let createdTime: String?
        /// The model description.
        public let description: String?
        /// The model label schema.
        public let labelSchema: LabelSchema?
        /// The timestamp when the model was last updated.
        public let lastUpdatedTime: String?
        /// The model ID.
        public let modelId: String?
        /// The model type.
        public let modelType: ModelTypeEnum?
        /// The model variables.
        public let modelVariables: [ModelVariable]?
        /// The model version.
        public let modelVersionNumber: String?
        /// The model status.
        public let status: String?
        /// The model training data source.
        public let trainingDataSource: TrainingDataSource?
        /// The model training metrics.
        public let trainingMetrics: [String: String]?
        /// The model validation metrics.
        public let validationMetrics: [String: String]?

        public init(createdTime: String? = nil, description: String? = nil, labelSchema: LabelSchema? = nil, lastUpdatedTime: String? = nil, modelId: String? = nil, modelType: ModelTypeEnum? = nil, modelVariables: [ModelVariable]? = nil, modelVersionNumber: String? = nil, status: String? = nil, trainingDataSource: TrainingDataSource? = nil, trainingMetrics: [String: String]? = nil, validationMetrics: [String: String]? = nil) {
            self.createdTime = createdTime
            self.description = description
            self.labelSchema = labelSchema
            self.lastUpdatedTime = lastUpdatedTime
            self.modelId = modelId
            self.modelType = modelType
            self.modelVariables = modelVariables
            self.modelVersionNumber = modelVersionNumber
            self.status = status
            self.trainingDataSource = trainingDataSource
            self.trainingMetrics = trainingMetrics
            self.validationMetrics = validationMetrics
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case description = "description"
            case labelSchema = "labelSchema"
            case lastUpdatedTime = "lastUpdatedTime"
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVariables = "modelVariables"
            case modelVersionNumber = "modelVersionNumber"
            case status = "status"
            case trainingDataSource = "trainingDataSource"
            case trainingMetrics = "trainingMetrics"
            case validationMetrics = "validationMetrics"
        }
    }

    public struct Outcome: AWSDecodableShape {

        /// The timestamp when the outcome was created.
        public let createdTime: String?
        /// The outcome description.
        public let description: String?
        /// The timestamp when the outcome was last updated.
        public let lastUpdatedTime: String?
        /// The outcome name.
        public let name: String?

        public init(createdTime: String? = nil, description: String? = nil, lastUpdatedTime: String? = nil, name: String? = nil) {
            self.createdTime = createdTime
            self.description = description
            self.lastUpdatedTime = lastUpdatedTime
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case description = "description"
            case lastUpdatedTime = "lastUpdatedTime"
            case name = "name"
        }
    }

    public struct PutDetectorRequest: AWSEncodableShape {

        /// The description of the detector.
        public let description: String?
        /// The detector ID. 
        public let detectorId: String

        public init(description: String? = nil, detectorId: String) {
            self.description = description
            self.detectorId = detectorId
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case detectorId = "detectorId"
        }
    }

    public struct PutDetectorResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct PutExternalModelRequest: AWSEncodableShape {

        /// The model endpoint input configuration.
        public let inputConfiguration: ModelInputConfiguration
        /// The model endpoints name.
        public let modelEndpoint: String
        /// The model endpoint’s status in Amazon Fraud Detector.
        public let modelEndpointStatus: ModelEndpointStatus
        /// The source of the model.
        public let modelSource: ModelSource
        /// The model endpoint output configuration.
        public let outputConfiguration: ModelOutputConfiguration
        /// The IAM role used to invoke the model endpoint.
        public let role: Role

        public init(inputConfiguration: ModelInputConfiguration, modelEndpoint: String, modelEndpointStatus: ModelEndpointStatus, modelSource: ModelSource, outputConfiguration: ModelOutputConfiguration, role: Role) {
            self.inputConfiguration = inputConfiguration
            self.modelEndpoint = modelEndpoint
            self.modelEndpointStatus = modelEndpointStatus
            self.modelSource = modelSource
            self.outputConfiguration = outputConfiguration
            self.role = role
        }

        private enum CodingKeys: String, CodingKey {
            case inputConfiguration = "inputConfiguration"
            case modelEndpoint = "modelEndpoint"
            case modelEndpointStatus = "modelEndpointStatus"
            case modelSource = "modelSource"
            case outputConfiguration = "outputConfiguration"
            case role = "role"
        }
    }

    public struct PutExternalModelResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct PutModelRequest: AWSEncodableShape {

        /// The model description. 
        public let description: String?
        /// The label schema.
        public let labelSchema: LabelSchema
        /// The model ID.
        public let modelId: String
        /// The model type. 
        public let modelType: ModelTypeEnum
        /// The model input variables.
        public let modelVariables: [ModelVariable]
        /// The training data source location in Amazon S3. 
        public let trainingDataSource: TrainingDataSource

        public init(description: String? = nil, labelSchema: LabelSchema, modelId: String, modelType: ModelTypeEnum, modelVariables: [ModelVariable], trainingDataSource: TrainingDataSource) {
            self.description = description
            self.labelSchema = labelSchema
            self.modelId = modelId
            self.modelType = modelType
            self.modelVariables = modelVariables
            self.trainingDataSource = trainingDataSource
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
            try self.trainingDataSource.validate(name: "\(name).trainingDataSource")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case labelSchema = "labelSchema"
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVariables = "modelVariables"
            case trainingDataSource = "trainingDataSource"
        }
    }

    public struct PutModelResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct PutOutcomeRequest: AWSEncodableShape {

        /// The outcome description.
        public let description: String?
        /// The name of the outcome.
        public let name: String

        public init(description: String? = nil, name: String) {
            self.description = description
            self.name = name
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.name, name: "name", parent: name, max: 64)
            try validate(self.name, name: "name", parent: name, min: 1)
            try validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case name = "name"
        }
    }

    public struct PutOutcomeResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct Role: AWSEncodableShape & AWSDecodableShape {

        /// The role ARN.
        public let arn: String
        /// The role name.
        public let name: String

        public init(arn: String, name: String) {
            self.arn = arn
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case arn = "arn"
            case name = "name"
        }
    }

    public struct Rule: AWSEncodableShape & AWSDecodableShape {

        /// The detector for which the rule is associated.
        public let detectorId: String
        /// The rule ID.
        public let ruleId: String
        /// The rule version.
        public let ruleVersion: String

        public init(detectorId: String, ruleId: String, ruleVersion: String) {
            self.detectorId = detectorId
            self.ruleId = ruleId
            self.ruleVersion = ruleVersion
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.ruleId, name: "ruleId", parent: name, max: 64)
            try validate(self.ruleId, name: "ruleId", parent: name, min: 1)
            try validate(self.ruleId, name: "ruleId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.ruleVersion, name: "ruleVersion", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case ruleId = "ruleId"
            case ruleVersion = "ruleVersion"
        }
    }

    public struct RuleDetail: AWSDecodableShape {

        /// The timestamp of when the rule was created.
        public let createdTime: String?
        /// The rule description.
        public let description: String?
        /// The detector for which the rule is associated.
        public let detectorId: String?
        /// The rule expression.
        public let expression: String?
        /// The rule language.
        public let language: Language?
        /// Timestamp of the last time the rule was updated.
        public let lastUpdatedTime: String?
        /// The rule outcomes.
        public let outcomes: [String]?
        /// The rule ID.
        public let ruleId: String?
        /// The rule version.
        public let ruleVersion: String?

        public init(createdTime: String? = nil, description: String? = nil, detectorId: String? = nil, expression: String? = nil, language: Language? = nil, lastUpdatedTime: String? = nil, outcomes: [String]? = nil, ruleId: String? = nil, ruleVersion: String? = nil) {
            self.createdTime = createdTime
            self.description = description
            self.detectorId = detectorId
            self.expression = expression
            self.language = language
            self.lastUpdatedTime = lastUpdatedTime
            self.outcomes = outcomes
            self.ruleId = ruleId
            self.ruleVersion = ruleVersion
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case description = "description"
            case detectorId = "detectorId"
            case expression = "expression"
            case language = "language"
            case lastUpdatedTime = "lastUpdatedTime"
            case outcomes = "outcomes"
            case ruleId = "ruleId"
            case ruleVersion = "ruleVersion"
        }
    }

    public struct RuleResult: AWSDecodableShape {

        /// The outcomes of the matched rule, based on the rule execution mode.
        public let outcomes: [String]?
        /// The rule ID that was matched, based on the rule execution mode.
        public let ruleId: String?

        public init(outcomes: [String]? = nil, ruleId: String? = nil) {
            self.outcomes = outcomes
            self.ruleId = ruleId
        }

        private enum CodingKeys: String, CodingKey {
            case outcomes = "outcomes"
            case ruleId = "ruleId"
        }
    }

    public struct TrainingDataSource: AWSEncodableShape & AWSDecodableShape {

        /// The data access role ARN for the training data source.
        public let dataAccessRoleArn: String
        /// The data location of the training data source.
        public let dataLocation: String

        public init(dataAccessRoleArn: String, dataLocation: String) {
            self.dataAccessRoleArn = dataAccessRoleArn
            self.dataLocation = dataLocation
        }

        public func validate(name: String) throws {
            try validate(self.dataAccessRoleArn, name: "dataAccessRoleArn", parent: name, max: 256)
            try validate(self.dataAccessRoleArn, name: "dataAccessRoleArn", parent: name, min: 1)
            try validate(self.dataAccessRoleArn, name: "dataAccessRoleArn", parent: name, pattern: "^arn\\:aws\\:iam\\:\\:[0-9]{12}\\:role\\/[^\\s]{2,64}$")
            try validate(self.dataLocation, name: "dataLocation", parent: name, max: 512)
            try validate(self.dataLocation, name: "dataLocation", parent: name, min: 1)
            try validate(self.dataLocation, name: "dataLocation", parent: name, pattern: "^s3:\\/\\/(.+)$")
        }

        private enum CodingKeys: String, CodingKey {
            case dataAccessRoleArn = "dataAccessRoleArn"
            case dataLocation = "dataLocation"
        }
    }

    public struct UpdateDetectorVersionMetadataRequest: AWSEncodableShape {

        /// The description.
        public let description: String
        /// The detector ID.
        public let detectorId: String
        /// The detector version ID. 
        public let detectorVersionId: String

        public init(description: String, detectorId: String, detectorVersionId: String) {
            self.description = description
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.detectorVersionId, name: "detectorVersionId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
        }
    }

    public struct UpdateDetectorVersionMetadataResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct UpdateDetectorVersionRequest: AWSEncodableShape {

        /// The detector version description. 
        public let description: String?
        /// The parent detector ID for the detector version you want to update.
        public let detectorId: String
        /// The detector version ID. 
        public let detectorVersionId: String
        /// The Amazon SageMaker model endpoints to include in the detector version.
        public let externalModelEndpoints: [String]
        /// The model versions to include in the detector version.
        public let modelVersions: [ModelVersion]?
        /// The rule execution mode to add to the detector. If you specify FIRST_MATCHED, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule. If you specifiy ALL_MATCHED, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules. You can define and edit the rule mode at the detector version level, when it is in draft status. The default behavior is FIRST_MATCHED.
        public let ruleExecutionMode: RuleExecutionMode?
        /// The rules to include in the detector version.
        public let rules: [Rule]

        public init(description: String? = nil, detectorId: String, detectorVersionId: String, externalModelEndpoints: [String], modelVersions: [ModelVersion]? = nil, ruleExecutionMode: RuleExecutionMode? = nil, rules: [Rule]) {
            self.description = description
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
            self.externalModelEndpoints = externalModelEndpoints
            self.modelVersions = modelVersions
            self.ruleExecutionMode = ruleExecutionMode
            self.rules = rules
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.detectorVersionId, name: "detectorVersionId", parent: name, min: 1)
            try self.modelVersions?.forEach {
                try $0.validate(name: "\(name).modelVersions[]")
            }
            try self.rules.forEach {
                try $0.validate(name: "\(name).rules[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
            case externalModelEndpoints = "externalModelEndpoints"
            case modelVersions = "modelVersions"
            case ruleExecutionMode = "ruleExecutionMode"
            case rules = "rules"
        }
    }

    public struct UpdateDetectorVersionResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct UpdateDetectorVersionStatusRequest: AWSEncodableShape {

        /// The detector ID. 
        public let detectorId: String
        /// The detector version ID. 
        public let detectorVersionId: String
        /// The new status.
        public let status: DetectorVersionStatus

        public init(detectorId: String, detectorVersionId: String, status: DetectorVersionStatus) {
            self.detectorId = detectorId
            self.detectorVersionId = detectorVersionId
            self.status = status
        }

        public func validate(name: String) throws {
            try validate(self.detectorId, name: "detectorId", parent: name, max: 64)
            try validate(self.detectorId, name: "detectorId", parent: name, min: 1)
            try validate(self.detectorId, name: "detectorId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.detectorVersionId, name: "detectorVersionId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case detectorId = "detectorId"
            case detectorVersionId = "detectorVersionId"
            case status = "status"
        }
    }

    public struct UpdateDetectorVersionStatusResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct UpdateModelVersionRequest: AWSEncodableShape {

        /// The model description.
        public let description: String
        /// The model ID.
        public let modelId: String
        /// The model type.
        public let modelType: ModelTypeEnum
        /// The model version.
        public let modelVersionNumber: String
        /// The new model status.
        public let status: ModelVersionStatus

        public init(description: String, modelId: String, modelType: ModelTypeEnum, modelVersionNumber: String, status: ModelVersionStatus) {
            self.description = description
            self.modelId = modelId
            self.modelType = modelType
            self.modelVersionNumber = modelVersionNumber
            self.status = status
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, max: 64)
            try validate(self.modelId, name: "modelId", parent: name, min: 1)
            try validate(self.modelId, name: "modelId", parent: name, pattern: "^[0-9a-z_-]+$")
            try validate(self.modelVersionNumber, name: "modelVersionNumber", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case modelId = "modelId"
            case modelType = "modelType"
            case modelVersionNumber = "modelVersionNumber"
            case status = "status"
        }
    }

    public struct UpdateModelVersionResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct UpdateRuleMetadataRequest: AWSEncodableShape {

        /// The rule description.
        public let description: String
        /// The rule to update.
        public let rule: Rule

        public init(description: String, rule: Rule) {
            self.description = description
            self.rule = rule
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try self.rule.validate(name: "\(name).rule")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case rule = "rule"
        }
    }

    public struct UpdateRuleMetadataResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct UpdateRuleVersionRequest: AWSEncodableShape {

        /// The description.
        public let description: String?
        /// The rule expression.
        public let expression: String
        /// The language.
        public let language: Language
        /// The outcomes.
        public let outcomes: [String]
        /// The rule to update.
        public let rule: Rule

        public init(description: String? = nil, expression: String, language: Language, outcomes: [String], rule: Rule) {
            self.description = description
            self.expression = expression
            self.language = language
            self.outcomes = outcomes
            self.rule = rule
        }

        public func validate(name: String) throws {
            try validate(self.description, name: "description", parent: name, max: 128)
            try validate(self.description, name: "description", parent: name, min: 1)
            try validate(self.expression, name: "expression", parent: name, max: 4096)
            try validate(self.expression, name: "expression", parent: name, min: 1)
            try validate(self.outcomes, name: "outcomes", parent: name, min: 1)
            try self.rule.validate(name: "\(name).rule")
        }

        private enum CodingKeys: String, CodingKey {
            case description = "description"
            case expression = "expression"
            case language = "language"
            case outcomes = "outcomes"
            case rule = "rule"
        }
    }

    public struct UpdateRuleVersionResult: AWSDecodableShape {

        /// The new rule version that was created.
        public let rule: Rule?

        public init(rule: Rule? = nil) {
            self.rule = rule
        }

        private enum CodingKeys: String, CodingKey {
            case rule = "rule"
        }
    }

    public struct UpdateVariableRequest: AWSEncodableShape {

        /// The new default value of the variable.
        public let defaultValue: String?
        /// The new description.
        public let description: String?
        /// The name of the variable.
        public let name: String
        /// The variable type.
        public let variableType: String?

        public init(defaultValue: String? = nil, description: String? = nil, name: String, variableType: String? = nil) {
            self.defaultValue = defaultValue
            self.description = description
            self.name = name
            self.variableType = variableType
        }

        private enum CodingKeys: String, CodingKey {
            case defaultValue = "defaultValue"
            case description = "description"
            case name = "name"
            case variableType = "variableType"
        }
    }

    public struct UpdateVariableResult: AWSDecodableShape {


        public init() {
        }

    }

    public struct Variable: AWSDecodableShape {

        /// The time when the variable was created.
        public let createdTime: String?
        /// The data source of the variable.
        public let dataSource: DataSource?
        /// The data type of the variable.
        public let dataType: DataType?
        /// The default value of the variable.
        public let defaultValue: String?
        /// The description of the variable. 
        public let description: String?
        /// The time when variable was last updated.
        public let lastUpdatedTime: String?
        /// The name of the variable.
        public let name: String?
        /// The variable type of the variable.
        public let variableType: String?

        public init(createdTime: String? = nil, dataSource: DataSource? = nil, dataType: DataType? = nil, defaultValue: String? = nil, description: String? = nil, lastUpdatedTime: String? = nil, name: String? = nil, variableType: String? = nil) {
            self.createdTime = createdTime
            self.dataSource = dataSource
            self.dataType = dataType
            self.defaultValue = defaultValue
            self.description = description
            self.lastUpdatedTime = lastUpdatedTime
            self.name = name
            self.variableType = variableType
        }

        private enum CodingKeys: String, CodingKey {
            case createdTime = "createdTime"
            case dataSource = "dataSource"
            case dataType = "dataType"
            case defaultValue = "defaultValue"
            case description = "description"
            case lastUpdatedTime = "lastUpdatedTime"
            case name = "name"
            case variableType = "variableType"
        }
    }

    public struct VariableEntry: AWSEncodableShape {

        /// The data source of the variable entry.
        public let dataSource: String?
        /// The data type of the variable entry.
        public let dataType: String?
        /// The default value of the variable entry.
        public let defaultValue: String?
        /// The description of the variable entry.
        public let description: String?
        /// The name of the variable entry.
        public let name: String?
        /// The type of the variable entry.
        public let variableType: String?

        public init(dataSource: String? = nil, dataType: String? = nil, defaultValue: String? = nil, description: String? = nil, name: String? = nil, variableType: String? = nil) {
            self.dataSource = dataSource
            self.dataType = dataType
            self.defaultValue = defaultValue
            self.description = description
            self.name = name
            self.variableType = variableType
        }

        private enum CodingKeys: String, CodingKey {
            case dataSource = "dataSource"
            case dataType = "dataType"
            case defaultValue = "defaultValue"
            case description = "description"
            case name = "name"
            case variableType = "variableType"
        }
    }
}
