"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../lib/AWS/utils");
const utils_2 = require("../utils");
const action = {
    title: 'Send',
    description: 'Send event to AWS Kinesis',
    defaultSubscription: 'type = "track" or type = "identify" or type = "page" or type = "screen" or type = "group"',
    fields: {
        payload: {
            label: 'Payload',
            description: 'The data to send to AWS Kinesis',
            type: 'object',
            required: true,
            default: { '@path': '$.' }
        },
        partitionKey: {
            label: 'Partition Key',
            description: 'The partition key to use for the record',
            type: 'string',
            required: true,
            default: { '@path': '$.messageId' }
        },
        streamName: {
            label: 'Stream Name',
            description: 'The name of the Kinesis stream to send records to',
            type: 'string',
            required: true,
            disabledInputMethods: []
        },
        awsRegion: {
            label: 'AWS Region',
            description: 'The AWS region where the Kinesis stream is located',
            type: 'string',
            required: true,
            choices: utils_1.AWS_REGIONS,
            disabledInputMethods: ['variable', 'function', 'freeform', 'enrichment']
        },
        batch_size: {
            label: 'Max Batch Size',
            description: 'The maximum number of payloads to include in a batch.',
            type: 'number',
            required: false,
            minimum: 1,
            maximum: 500,
            default: 500,
            disabledInputMethods: ['variable', 'function', 'freeform', 'enrichment']
        },
        batch_keys: {
            label: 'Batch Keys',
            description: 'The keys to use for batching the events.',
            type: 'string',
            unsafe_hidden: true,
            default: ['awsRegion', 'streamName'],
            multiple: true
        },
        max_batch_size: {
            label: 'Max Batch Size',
            description: 'The maximum number of payloads to include in a batch.',
            type: 'number',
            required: true,
            minimum: 1,
            maximum: 500,
            default: 500,
            unsafe_hidden: true,
            disabledInputMethods: ['variable', 'function', 'freeform', 'enrichment']
        },
        enable_batching: {
            type: 'boolean',
            label: 'Batch Data to Kinesis?',
            description: 'If true, Segment will batch events before sending to Kinesis',
            default: true,
            unsafe_hidden: true
        },
        batch_bytes: {
            type: 'number',
            label: 'Batch Bytes',
            description: 'The number of bytes to write to the kinesis shard in a single batch. Limit is 1MB.',
            default: 1000000,
            required: true,
            unsafe_hidden: true
        }
    },
    perform: async (_requests, { settings, payload, statsContext, logger, signal }) => {
        await (0, utils_2.send)(settings, [payload], statsContext, logger, signal);
    },
    performBatch: async (_requests, { settings, payload, statsContext, logger, signal }) => {
        await (0, utils_2.send)(settings, payload, statsContext, logger, signal);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map