"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateSettings = validateSettings;
const actions_core_1 = require("@segment/actions-core");
function validateSettings(settings) {
    if (!settings.s3_access_key) {
        throw new actions_core_1.IntegrationError('Missing S3 Access Key', 'MISSING_S3_ACCESS_KEY', 400);
    }
    if (!settings.s3_secret) {
        throw new actions_core_1.IntegrationError('Missing S3 Secret.', 'MISSING_S3_SECRET', 400);
    }
    if (!settings.s3_region) {
        throw new actions_core_1.IntegrationError('Missing S3 Region', 'MISSING_S3_REGION', 400);
    }
    if (!settings.s3_bucket_accesspoint_alias) {
        throw new actions_core_1.IntegrationError('Missing S3 Bucket Access Point.', 'MISSING_S3_BUCKET_ACCESS_POINT', 400);
    }
    if (!settings.fileNamePrefix) {
        throw new actions_core_1.IntegrationError('Missing Customer Prefix. Customer Prefix should be of the form of 4-5 characters followed by an underscore character', 'MISSING_CUSTOMER_PREFIX', 400);
    }
    if (!settings.fileNamePrefix.endsWith('_')) {
        throw new actions_core_1.IntegrationError('Invalid Customer Prefix. Customer Prefix must end with an underscore character "_".  ', 'INVALID_CUSTOMER_PREFIX', 400);
    }
    if (settings.fileNamePrefix === 'customer_org_') {
        throw new actions_core_1.IntegrationError('Unedited Customer Prefix. Customer Prefix remains as the default value, must edit and provide a valid Customer prefix (4-5 characters) followed by an underscore', 'INVALID_CUSTOMER_PREFIX', 400);
    }
}
//# sourceMappingURL=preCheck.js.map