"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cordial_client_1 = __importDefault(require("../cordial-client"));
const identities_fields_1 = __importDefault(require("../identities-fields"));
const action = {
    title: 'Add Contact to List',
    description: 'Add contact to a list. If the list does not exist in Cordial it will be created.',
    defaultSubscription: 'type = "group"',
    fields: {
        ...identities_fields_1.default,
        groupId: {
            label: 'Group ID',
            description: 'Segment group id. Required.',
            type: 'string',
            required: true,
            default: {
                '@path': '$.groupId'
            }
        },
        listName: {
            label: 'List name',
            description: 'Cordial list name. Optional. If list name is empty, the name of the list will be set to segment_[groupId].',
            type: 'string',
            default: {
                '@path': '$.traits.name'
            }
        }
    },
    perform: async (request, { settings, payload }) => {
        const client = new cordial_client_1.default(settings, request);
        return client.addContactToList(payload);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map