"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const dd_api_1 = __importDefault(require("../dd-api"));
const types_1 = require("../types");
class DDEnrolmentApi extends dd_api_1.default {
    constructor(settings, client) {
        super(settings, client);
    }
    async getPrograms() {
        const response = await this.get('/v2/programs');
        const programs = response.data;
        const choices = programs
            .filter((program) => program.status === types_1.ProgramStatus.Active)
            .map((program) => ({
            value: program.id.toString(),
            label: program.name
        }));
        return { choices };
    }
    async enrolContact(programId, contact) {
        const json = {
            contacts: [contact.contactId],
            programId
        };
        const response = await this.post('/v2/programs/enrolments', json);
        return response.data;
    }
}
exports.default = DDEnrolmentApi;
//# sourceMappingURL=dd-enrolment-api.js.map