import * as HttpClient from "effect/unstable/http/HttpClient";
import * as S from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import * as C from "../category.js";
const svc = T.AwsApiService({
    sdkId: "Bedrock Data Automation Runtime",
    serviceShapeName: "AmazonBedrockKeystoneRuntimeService",
});
const auth = T.AwsAuthSigv4({ name: "bedrock" });
const ver = T.ServiceVersion("2024-06-13");
const proto = T.AwsProtocolsAwsJson1_1();
const rules = T.EndpointResolver((p, _) => {
    const { Region, UseDualStack = false, UseFIPS = false, Endpoint } = p;
    const e = (u, p = {}, h = {}) => ({
        type: "endpoint",
        endpoint: { url: u, properties: p, headers: h },
    });
    const err = (m) => ({
        type: "error",
        message: m,
    });
    if (Endpoint != null) {
        if (UseFIPS === true) {
            return err("Invalid Configuration: FIPS and custom endpoint are not supported");
        }
        if (UseDualStack === true) {
            return err("Invalid Configuration: Dualstack and custom endpoint are not supported");
        }
        return e(Endpoint);
    }
    if (Region != null) {
        {
            const PartitionResult = _.partition(Region);
            if (PartitionResult != null && PartitionResult !== false) {
                if (UseFIPS === true && UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsFIPS") &&
                        true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://bedrock-data-automation-runtime-fips.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("FIPS and DualStack are enabled, but this partition does not support one or both");
                }
                if (UseFIPS === true) {
                    if (_.getAttr(PartitionResult, "supportsFIPS") === true) {
                        return e(`https://bedrock-data-automation-runtime-fips.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
                    }
                    return err("FIPS is enabled but this partition does not support FIPS");
                }
                if (UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://bedrock-data-automation-runtime.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("DualStack is enabled but this partition does not support DualStack");
                }
                return e(`https://bedrock-data-automation-runtime.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
            }
        }
    }
    return err("Invalid Configuration: Missing Region");
});
export const SyncInputConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ bytes: S.optional(T.Blob), s3Uri: S.optional(S.String) })).annotate({
    identifier: "SyncInputConfiguration",
});
export const DataAutomationStage = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const DataAutomationConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    dataAutomationProjectArn: S.String,
    stage: S.optional(DataAutomationStage),
})).annotate({
    identifier: "DataAutomationConfiguration",
});
export const BlueprintStage = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const Blueprint = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    blueprintArn: S.String,
    version: S.optional(S.String),
    stage: S.optional(BlueprintStage),
})).annotate({ identifier: "Blueprint" });
export const BlueprintList = /*@__PURE__*/ /*#__PURE__*/ S.Array(Blueprint);
export const EncryptionContextMap = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, S.String.pipe(S.optional));
export const EncryptionConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    kmsKeyId: S.String,
    kmsEncryptionContext: S.optional(EncryptionContextMap),
})).annotate({
    identifier: "EncryptionConfiguration",
});
export const OutputConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ s3Uri: S.String })).annotate({
    identifier: "OutputConfiguration",
});
export const InvokeDataAutomationRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    inputConfiguration: SyncInputConfiguration,
    dataAutomationConfiguration: S.optional(DataAutomationConfiguration),
    blueprints: S.optional(BlueprintList),
    dataAutomationProfileArn: S.String,
    encryptionConfiguration: S.optional(EncryptionConfiguration),
    outputConfiguration: S.optional(OutputConfiguration),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "InvokeDataAutomationRequest",
});
export const SemanticModality = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const CustomOutputStatus = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const OutputSegment = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    customOutputStatus: S.optional(CustomOutputStatus),
    customOutput: S.optional(S.String),
    standardOutput: S.optional(S.String),
})).annotate({ identifier: "OutputSegment" });
export const OutputSegmentList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(OutputSegment);
export const InvokeDataAutomationResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    outputConfiguration: S.optional(OutputConfiguration),
    semanticModality: SemanticModality,
    outputSegments: S.optional(OutputSegmentList),
})).annotate({
    identifier: "InvokeDataAutomationResponse",
});
export const ListTagsForResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ resourceARN: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListTagsForResourceRequest",
});
export const Tag = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ key: S.String, value: S.String })).annotate({ identifier: "Tag" });
export const TagList = /*@__PURE__*/ /*#__PURE__*/ S.Array(Tag);
export const ListTagsForResourceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ tags: S.optional(TagList) })).annotate({
    identifier: "ListTagsForResourceResponse",
});
export const TagResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ resourceARN: S.String, tags: TagList }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "TagResourceRequest",
});
export const TagResourceResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "TagResourceResponse",
});
export const TagKeyList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const UntagResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ resourceARN: S.String, tagKeys: TagKeyList }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "UntagResourceRequest",
});
export const UntagResourceResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "UntagResourceResponse",
});
export const TimestampSegment = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ startTimeMillis: S.Number, endTimeMillis: S.Number })).annotate({
    identifier: "TimestampSegment",
});
export const VideoSegmentConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.Union([
    S.Struct({ timestampSegment: TimestampSegment }),
]);
export const VideoAssetProcessingConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ segmentConfiguration: S.optional(VideoSegmentConfiguration) })).annotate({
    identifier: "VideoAssetProcessingConfiguration",
});
export const AssetProcessingConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ video: S.optional(VideoAssetProcessingConfiguration) })).annotate({
    identifier: "AssetProcessingConfiguration",
});
export const InputConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    s3Uri: S.String,
    assetProcessingConfiguration: S.optional(AssetProcessingConfiguration),
})).annotate({
    identifier: "InputConfiguration",
});
export const EventBridgeConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ eventBridgeEnabled: S.Boolean })).annotate({
    identifier: "EventBridgeConfiguration",
});
export const NotificationConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ eventBridgeConfiguration: EventBridgeConfiguration })).annotate({
    identifier: "NotificationConfiguration",
});
export const InvokeDataAutomationAsyncRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    clientToken: S.optional(S.String).pipe(T.IdempotencyToken()),
    inputConfiguration: InputConfiguration,
    outputConfiguration: OutputConfiguration,
    dataAutomationConfiguration: S.optional(DataAutomationConfiguration),
    encryptionConfiguration: S.optional(EncryptionConfiguration),
    notificationConfiguration: S.optional(NotificationConfiguration),
    blueprints: S.optional(BlueprintList),
    dataAutomationProfileArn: S.String,
    tags: S.optional(TagList),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "InvokeDataAutomationAsyncRequest",
});
export const InvokeDataAutomationAsyncResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ invocationArn: S.String })).annotate({
    identifier: "InvokeDataAutomationAsyncResponse",
});
export const GetDataAutomationStatusRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    invocationArn: S.String.pipe(T.HttpLabel("invocationArn")),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetDataAutomationStatusRequest",
});
export const AutomationJobStatus = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const GetDataAutomationStatusResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    status: S.optional(AutomationJobStatus),
    errorType: S.optional(S.String),
    errorMessage: S.optional(S.String),
    outputConfiguration: S.optional(OutputConfiguration),
    jobSubmissionTime: S.optional(T.DateFromString.pipe(T.TimestampFormat("date-time"))),
    jobCompletionTime: S.optional(T.DateFromString.pipe(T.TimestampFormat("date-time"))),
    jobDurationInSeconds: S.optional(S.Number),
})).annotate({
    identifier: "GetDataAutomationStatusResponse",
});
//# Errors
export class AccessDeniedException extends S.TaggedErrorClass()("AccessDeniedException", { message: S.optional(S.String) }).pipe(C.withAuthError) {
}
export class InternalServerException extends S.TaggedErrorClass()("InternalServerException", { message: S.optional(S.String) }).pipe(C.withServerError) {
}
export class ServiceUnavailableException extends S.TaggedErrorClass()("ServiceUnavailableException", { message: S.optional(S.String) }).pipe(C.withServerError) {
}
export class ThrottlingException extends S.TaggedErrorClass()("ThrottlingException", { message: S.optional(S.String) }).pipe(C.withThrottlingError) {
}
export class ValidationException extends S.TaggedErrorClass()("ValidationException", { message: S.optional(S.String) }).pipe(C.withBadRequestError) {
}
export class ResourceNotFoundException extends S.TaggedErrorClass()("ResourceNotFoundException", { message: S.optional(S.String) }).pipe(C.withBadRequestError) {
}
export class ServiceQuotaExceededException extends S.TaggedErrorClass()("ServiceQuotaExceededException", { message: S.optional(S.String) }).pipe(C.withQuotaError) {
}
/**
 * Sync API: Invoke data automation.
 */
export const invokeDataAutomation = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: InvokeDataAutomationRequest,
    output: InvokeDataAutomationResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ServiceUnavailableException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * List tags for an Amazon Bedrock Data Automation resource
 */
export const listTagsForResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListTagsForResourceRequest,
    output: ListTagsForResourceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Tag an Amazon Bedrock Data Automation resource
 */
export const tagResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: TagResourceRequest,
    output: TagResourceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Untag an Amazon Bedrock Data Automation resource
 */
export const untagResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UntagResourceRequest,
    output: UntagResourceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Async API: Invoke data automation.
 */
export const invokeDataAutomationAsync = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: InvokeDataAutomationAsyncRequest,
    output: InvokeDataAutomationAsyncResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * API used to get data automation status.
 */
export const getDataAutomationStatus = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetDataAutomationStatusRequest,
    output: GetDataAutomationStatusResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
//# sourceMappingURL=bedrock-data-automation-runtime.js.map