"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateSettings = exports.SettingsValidationSchema = exports.settings = void 0;
const lodash_1 = require("lodash");
const zod_1 = require("zod");
exports.settings = {
    integrationKey: {
        label: 'Integration key (client ID)',
        key: 'integrationKey',
        obfuscated: true,
        required: true,
        description: 'An integration key identifies your integration and links to its configuration values. This can be obtained in your developer account from the Apps and Keys page',
    },
    accountId: {
        label: 'API Account ID',
        key: 'accountId',
        obfuscated: false,
        required: true,
        description: 'A GUID value that identifies your account. This can be obtained in your developer account from the Apps and Keys page',
    },
    userId: {
        label: 'Impersonated User ID (UserID)',
        key: 'userId',
        obfuscated: false,
        required: true,
        description: 'This is a GUID identifying the DocuSign user that you will be impersonating with the access token. Your own User ID can be found at the top of the Apps and Keys page.',
    },
    rsaKey: {
        label: 'RSA private key (in Base64 format)',
        key: 'rsaKey',
        obfuscated: true,
        required: true,
        description: "This is for the integration key you obtained above and can also be created on the Apps and Keys page. You only need the private key, and it can only be copied once. Make sure to retain it for your records. Provide it in Base64 format - if you copy the key as is, it will not be valid as newlines and formatting won't be persisted.",
    },
    baseApiUrl: {
        label: 'Base API URL (DocuSign)',
        key: 'baseApiUrl',
        obfuscated: false,
        required: false,
        description: 'Base API URL for API calls matching your environment on DocuSign. Defaults to: https://demo.docusign.net. Remember that this URL MUST match the one you registered for your app in DocuSign settings. Can be obtained from Account Base URI section of the Apps and Keys page or the "base_uri" property in the response of a call to the "/oauth/userinfo"',
    },
    returnUrlTemplate: {
        label: 'Return URL template',
        key: 'returnUrlTemplate',
        obfuscated: false,
        required: false,
        description: 'Return URL for your application to which DocuSign will redirect the user after signing the document. Set when you self host your application. You can use {sessionId}, {pathwayId}, {activityId} and {stakeholderId} variables to construct the URL, where variables will be replaced with actual values. Defaults to: "https://goto.development.awell.health/?sessionId={sessionId}".',
    },
};
exports.SettingsValidationSchema = zod_1.z.object({
    integrationKey: zod_1.z.string(),
    accountId: zod_1.z.string(),
    userId: zod_1.z.string(),
    rsaKey: zod_1.z.string(),
    baseApiUrl: zod_1.z
        .union([zod_1.z.string().url().optional(), zod_1.z.literal('')])
        .transform((value) => {
        if ((0, lodash_1.isNil)(value) || value === '') {
            // default value
            return 'https://demo.docusign.net';
        }
        return value;
    }),
    returnUrlTemplate: zod_1.z
        .union([zod_1.z.string().url().optional(), zod_1.z.literal('')])
        .transform((value) => {
        if ((0, lodash_1.isNil)(value) || value === '') {
            // default value
            return 'https://goto.development.awell.health/?sessionId={sessionId}';
        }
        return value;
    }),
});
const validateSettings = (settings) => {
    const parsedData = exports.SettingsValidationSchema.parse(settings);
    return parsedData;
};
exports.validateSettings = validateSettings;
//# sourceMappingURL=settings.js.map