"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.prolongWebRTCChannel = exports.addSubDevice = exports.updateSubDevice = exports.getWebRTCChannel = exports.deleteSubDevice = exports.setDeviceSetting = exports.getCertainScenes = exports.getGateWayAndSubDevice = exports.executeScene = exports.getDeviceUser = void 0;
const utils_1 = require("../utils");
function getDeviceUser() {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest('/v2/d/user', 'GET', {});
    });
}
exports.getDeviceUser = getDeviceUser;
function executeScene(id) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest('/v2/d/execute-scene', 'POST', { id });
    });
}
exports.executeScene = executeScene;
function getGateWayAndSubDevice() {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest('/v2/d/gateway', 'GET', {});
    });
}
exports.getGateWayAndSubDevice = getGateWayAndSubDevice;
function getCertainScenes(sceneIds) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest('/v2/d/get-the-scene', 'POST', { sceneIds });
    });
}
exports.getCertainScenes = getCertainScenes;
function setDeviceSetting(settings) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest('/v2/d/settings', 'PUT', { settings });
    });
}
exports.setDeviceSetting = setDeviceSetting;
function deleteSubDevice(id) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest(`/v2/d/gateway/sub-device?deviceid=${id}`, 'DELETE', {});
    });
}
exports.deleteSubDevice = deleteSubDevice;
function getWebRTCChannel(from) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest(`/v2/d/webrtc/channel?from=${from}`, 'GET', {});
    });
}
exports.getWebRTCChannel = getWebRTCChannel;
function updateSubDevice(params) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest(`/v2/d/gateway/sub-device`, 'PUT', params);
    });
}
exports.updateSubDevice = updateSubDevice;
function addSubDevice(params) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest(`/v2/d/gateway/sub-device`, 'POST', params);
    });
}
exports.addSubDevice = addSubDevice;
function prolongWebRTCChannel(arn) {
    return __awaiter(this, void 0, void 0, function* () {
        return yield utils_1.sendRequest(`/v2/d/webrtc/renewal-channel`, 'POST', {
            arn,
        });
    });
}
exports.prolongWebRTCChannel = prolongWebRTCChannel;
