"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const baseRequestInterface_1 = __importDefault(require("../common/baseRequestInterface"));
const transforms_1 = require("../common/transforms");
const action = {
    title: 'Identify User',
    description: 'Identify a user in Nudge',
    defaultSubscription: 'type = "identify"',
    fields: {
        ext_id: {
            label: 'User ID',
            type: 'string',
            description: 'The ID of the user performing the action.',
            required: true,
            default: {
                '@path': '$.userId'
            }
        },
        name: {
            label: 'User Name',
            type: 'string',
            description: 'The name of the user',
            required: false,
            default: {
                '@path': '$.traits.name'
            }
        },
        phone: {
            label: 'Phone Number',
            type: 'string',
            description: 'The phone number of the user',
            required: false,
            default: {
                '@path': '$.traits.phone'
            }
        },
        email: {
            label: 'Email',
            type: 'string',
            description: 'The email of the user.',
            required: false,
            default: {
                '@path': '$.traits.email'
            }
        },
        tz: {
            label: 'Timezone',
            type: 'string',
            description: 'The timezone of the user.',
            required: false,
            default: {
                '@path': '$.context.timezone'
            }
        },
        props: {
            label: 'Properties',
            type: 'object',
            description: 'Properties for the user',
            required: false,
            default: {
                '@path': '$.traits'
            }
        }
    },
    perform: async (request, { settings, payload }) => {
        payload.ext_id = (0, transforms_1.sanitize)(payload.ext_id);
        payload.props = (0, transforms_1.modifyProps)(payload.props);
        return baseRequestInterface_1.default.identify(request, settings, payload);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map