"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SipGateway = void 0;
const trunk_1 = require("../trunk");
class SipGateway {
    constructor(values) {
        Object.assign(this, values);
    }
    getTrunkDevices(trunkList) {
        return this.trunks.map((id) => trunkList.find((t) => t.id === id)).map((t) => new trunk_1.Trunk(t));
    }
    onCompleteDevice(deviceList) {
        return deviceList.find((d) => d.id === this.onComplete);
    }
    onFailDevice(deviceList) {
        return deviceList.find((d) => d.id === this.onFail);
    }
    onNoAnswerDevice(deviceList) {
        return deviceList.find((d) => d.id === this.onNoAnswer);
    }
    onBusyDevice(deviceList) {
        return deviceList.find((d) => d.id === this.onBusy);
    }
}
exports.SipGateway = SipGateway;
