"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrganisationMetricDailyService = exports.OrganisationMetricMonthlyService = exports.CallsService = exports.DeviceContactService = exports.ContactService = exports.VoiceServerService = exports.OutboundRouteService = exports.OutboundProxyService = exports.EventGroupService = exports.OrganisationChargeUtilService = exports.OrganisationChargeService = exports.TicketProductTableService = exports.AssignmentTicketService = exports.ExportTicketService = exports.GlobalNumberTicketService = exports.MigrationTicketService = exports.AllocationTicketService = exports.PortingTicketService = exports.TicketChargeService = exports.TicketStatusService = exports.TicketEmailService = exports.TicketCommentService = exports.TicketNoteService = exports.CodeDeckCodeService = exports.ProductTableProductService = exports.RatingTableRateService = exports.UserDeviceService = exports.AccountStatusService = exports.WebhookService = exports.SettingService = exports.DDIService = exports.AssetService = exports.TrunkService = exports.DeviceService = void 0;
const BaseAPIService_1 = require("./BaseAPIService");
class UserChildService extends BaseAPIService_1.default {
    constructor(baseURL, token, userId, serviceName) {
        super(baseURL, `users/${userId}/${serviceName}`, token);
    }
}
class AccountChildService extends BaseAPIService_1.default {
    constructor(baseURL, token, accountId, serviceName) {
        super(baseURL, `account/${accountId}/${serviceName}`, token);
    }
}
class RatingTableRateService extends BaseAPIService_1.default {
    constructor(baseURL, token, ratingTableId) {
        super(baseURL, `billing/ratingTable/${ratingTableId}/rates`, token);
    }
}
exports.RatingTableRateService = RatingTableRateService;
class ProductTableProductService extends BaseAPIService_1.default {
    constructor(baseURL, token, productTableId) {
        super(baseURL, `billing/productTable/${productTableId}/products`, token);
    }
}
exports.ProductTableProductService = ProductTableProductService;
class CodeDeckCodeService extends BaseAPIService_1.default {
    constructor(baseURL, token, productTableId) {
        super(baseURL, `billing/codeDeck/${productTableId}/codes`, token);
    }
}
exports.CodeDeckCodeService = CodeDeckCodeService;
class OutboundProxyService extends BaseAPIService_1.default {
    constructor(baseURL, token, regionId) {
        super(baseURL, `voiceRegion/${regionId}/proxies`, token);
    }
}
exports.OutboundProxyService = OutboundProxyService;
class OutboundRouteService extends BaseAPIService_1.default {
    constructor(baseURL, token, regionId) {
        super(baseURL, `voiceRegion/${regionId}/routes`, token);
    }
}
exports.OutboundRouteService = OutboundRouteService;
class VoiceServerService extends BaseAPIService_1.default {
    constructor(baseURL, token, regionId) {
        super(baseURL, `voiceRegion/${regionId}/servers`, token);
    }
}
exports.VoiceServerService = VoiceServerService;
class DeviceService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'device');
    }
}
exports.DeviceService = DeviceService;
class TrunkService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'trunk');
    }
}
exports.TrunkService = TrunkService;
class AssetService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'asset');
    }
}
exports.AssetService = AssetService;
class DDIService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'ddi');
    }
    release(id) {
        return super.delete(id + '/release');
    }
}
exports.DDIService = DDIService;
class SettingService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'setting');
    }
}
exports.SettingService = SettingService;
class WebhookService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'hook');
    }
}
exports.WebhookService = WebhookService;
class AccountStatusService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'status');
    }
}
exports.AccountStatusService = AccountStatusService;
class EventGroupService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'events');
        this.accountId = accountId;
    }
    sequence(id) {
        return super.getString(`${id}/sequence`);
    }
    pcap(id) {
        return super.getArrayBuffer(`${id}/pcap`);
    }
    recordings(id) {
        return new EventGroupRecordingService(this.baseURL, this.token, this.accountId, id).get('');
    }
    cdrs(id) {
        return new EventGroupCDRService(this.baseURL, this.token, this.accountId, id).get('');
    }
}
exports.EventGroupService = EventGroupService;
class EventService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'callableEvents');
        this.accountId = accountId;
    }
    acknowledge(id) {
        return super.getString(`${id}/sequence`);
    }
    pcap(id) {
        return super.getArrayBuffer(`${id}/pcap`);
    }
    recordings(id) {
        return new EventGroupRecordingService(this.baseURL, this.token, this.accountId, id).get('');
    }
    cdrs(id) {
        return new EventGroupCDRService(this.baseURL, this.token, this.accountId, id).get('');
    }
}
class DeviceContactService extends AccountChildService {
    constructor(baseURL, token, accountId, deviceId) {
        super(baseURL, token, accountId, 'contacts/device/' + deviceId);
        this.accountId = accountId;
    }
}
exports.DeviceContactService = DeviceContactService;
class ContactService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'contacts');
        this.accountId = accountId;
    }
    device(deviceId) {
        return new DeviceContactService(this.baseURL, this.token, this.accountId, deviceId);
    }
}
exports.ContactService = ContactService;
class CallsService extends AccountChildService {
    constructor(baseURL, token, accountId) {
        super(baseURL, token, accountId, 'calls');
    }
    park(callSid, putRequest) {
        return super.put(`park/${callSid}`, putRequest);
    }
    attendedTransfer(callSid, putRequest) {
        return super.put(`attended/${callSid}`, putRequest);
    }
    attendedTransferComplete(callSid, putRequest) {
        return super.put(`attended/${callSid}/complete`, putRequest);
    }
    transfer(callSid, putRequest) {
        return super.put(`transfer/${callSid}`, putRequest);
    }
    conference(callSid, putRequest) {
        return super.put(`conference/${callSid}`, putRequest);
    }
    recover(callSid, putRequest) {
        return super.put(`recover/${callSid}`, putRequest);
    }
    merge(callSid, putRequest) {
        return super.put(`merge/${callSid}`, putRequest);
    }
    queue(callSid, putRequest) {
        return super.put(`queue/${callSid}`, putRequest);
    }
}
exports.CallsService = CallsService;
class UserDeviceService extends UserChildService {
    constructor(baseURL, token, userId) {
        super(baseURL, token, userId, 'device');
    }
}
exports.UserDeviceService = UserDeviceService;
class TicketCommentService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/${ticketId}/comment`, token);
    }
}
exports.TicketCommentService = TicketCommentService;
class TicketNoteService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/${ticketId}/note`, token);
    }
}
exports.TicketNoteService = TicketNoteService;
class TicketChargeService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/${ticketId}/charge`, token);
    }
}
exports.TicketChargeService = TicketChargeService;
class OrganisationChargeService extends BaseAPIService_1.default {
    constructor(baseURL, token, orgId) {
        super(baseURL, `organisation/${orgId}/charge`, token);
    }
    downloadServiceCharges(filter) {
        return super.filterString(filter, 'download/services');
    }
    downloadProductTable() {
        return super.getString('download/products');
    }
    downloadRatingTable() {
        return super.getString('download/rates');
    }
    downloadCDRs(year, month) {
        return super.getString(`download/cdrs/${year}/${month}`);
    }
}
exports.OrganisationChargeService = OrganisationChargeService;
class OrganisationMetricMonthlyService extends BaseAPIService_1.default {
    constructor(baseURL, token, orgId) {
        super(baseURL, `organisation/${orgId}/metrics/monthly`, token);
    }
    getMonth(year, month) {
        return super.get(`${year}/${month}`);
    }
}
exports.OrganisationMetricMonthlyService = OrganisationMetricMonthlyService;
class OrganisationMetricDailyService extends BaseAPIService_1.default {
    constructor(baseURL, token, orgId) {
        super(baseURL, `organisation/${orgId}/metrics/daily`, token);
    }
    getMonth(year, month) {
        return super.listByPath(`${year}/${month}`);
    }
}
exports.OrganisationMetricDailyService = OrganisationMetricDailyService;
class OrganisationChargeUtilService extends BaseAPIService_1.default {
    constructor(baseURL, token, orgId) {
        super(baseURL, `organisation/${orgId}/charge/util`, token);
    }
}
exports.OrganisationChargeUtilService = OrganisationChargeUtilService;
class PortingTicketSubmissionStatusService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId, submissionId) {
        super(baseURL, `ticket/portRequest/${ticketId}/submission/${submissionId}/status`, token);
    }
}
class EventGroupRecordingService extends BaseAPIService_1.default {
    constructor(baseURL, token, accountId, eventId) {
        super(baseURL, `account/${accountId}/events/${eventId}/recordings`, token);
    }
}
class EventGroupCDRService extends BaseAPIService_1.default {
    constructor(baseURL, token, accountId, eventId) {
        super(baseURL, `account/${accountId}/events/${eventId}/cdrs`, token);
    }
}
class PortingTicketSubmissionService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/portRequest/${ticketId}/submission`, token);
        this.ticketId = ticketId;
    }
    status(submissionId) {
        return new PortingTicketSubmissionStatusService(this.baseURL, this.token, this.ticketId, submissionId);
    }
}
class PortingTicketService extends BaseAPIService_1.default {
    constructor(baseURL, token) {
        super(baseURL, `ticket/portRequest`, token);
    }
    build(id) {
        return super.post(id + '/build', undefined);
    }
    submission(ticketId) {
        return new PortingTicketSubmissionService(this.baseURL, this.token, ticketId);
    }
}
exports.PortingTicketService = PortingTicketService;
class AllocationTicketService extends BaseAPIService_1.default {
    constructor(baseURL, token) {
        super(baseURL, `ticket/allocation`, token);
    }
    build(id) {
        return super.post(id + '/build', undefined);
    }
}
exports.AllocationTicketService = AllocationTicketService;
class MigrationTicketService extends BaseAPIService_1.default {
    constructor(baseURL, token) {
        super(baseURL, `ticket/migration`, token);
    }
    build(id) {
        return super.post(id + '/build', undefined);
    }
}
exports.MigrationTicketService = MigrationTicketService;
class ExportTicketService extends BaseAPIService_1.default {
    constructor(baseURL, token) {
        super(baseURL, `ticket/export`, token);
    }
    build(id) {
        return super.post(id + '/build', undefined);
    }
}
exports.ExportTicketService = ExportTicketService;
class GlobalNumberTicketService extends BaseAPIService_1.default {
    constructor(baseURL, token) {
        super(baseURL, `ticket/globalNumber`, token);
    }
    build(id) {
        return super.post(id + '/build', undefined);
    }
}
exports.GlobalNumberTicketService = GlobalNumberTicketService;
class AssignmentTicketService extends BaseAPIService_1.default {
    constructor(baseURL, token) {
        super(baseURL, `ticket/assignment`, token);
    }
}
exports.AssignmentTicketService = AssignmentTicketService;
class TicketProductTableService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/${ticketId}/productTable`, token);
        this.ticketId = ticketId;
    }
    get() {
        return super.get('');
    }
}
exports.TicketProductTableService = TicketProductTableService;
class TicketEmailService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/${ticketId}/emails`, token);
    }
}
exports.TicketEmailService = TicketEmailService;
class TicketStatusService extends BaseAPIService_1.default {
    constructor(baseURL, token, ticketId) {
        super(baseURL, `ticket/${ticketId}/status`, token);
    }
    update(status) {
        return super.put(status);
    }
    open() {
        return super.put('open');
    }
    pending() {
        return super.put('pending');
    }
    closed() {
        return super.put('closed');
    }
}
exports.TicketStatusService = TicketStatusService;
