"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
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());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
const components_1 = require("../themes/components");
const MediaRoomService_1 = require("../services/MediaRoomService");
const ConfigProvider_1 = require("../utils/ConfigProvider");
const styled_components_1 = require("styled-components");
const borderRadius_1 = __importDefault(require("../themes/foundations/borderRadius"));
const { DyteHelper } = react_native_1.NativeModules;
exports.default = ({ isOpen, onClose, onLeave, }) => {
    const { sessionConfig } = react_1.useContext(ConfigProvider_1.ConfigServiceContext);
    const windowDimensions = react_native_1.useWindowDimensions();
    const { height, width } = sessionConfig.theme.dimensions || windowDimensions;
    const modalWidth = width * 0.9;
    const modalButtonsWidth = modalWidth / 2 - 20;
    const { mediaRoom } = react_1.useContext(MediaRoomService_1.MediaRoomContext);
    const { colors } = react_1.useContext(styled_components_1.ThemeContext);
    const leaveRoomAndEndMeeting = () => __awaiter(void 0, void 0, void 0, function* () {
        yield mediaRoom.kickAll();
    });
    return (react_1.default.createElement(components_1.Modal, { isVisible: isOpen, backdropOpacity: 0.8, backdropColor: colors.secondary[800] },
        react_1.default.createElement(components_1.Flex, { width: modalWidth, bg: "secondary.1000", color: "textPrimary.100", px: 15, borderRadius: borderRadius_1.default.large },
            react_1.default.createElement(components_1.Flex, { py: 25 },
                react_1.default.createElement(components_1.Text, { fontSize: 28, fontWeight: "bold" }, "Leave")),
            react_1.default.createElement(components_1.Flex, null,
                react_1.default.createElement(components_1.Text, { fontSize: "lg" }, "Are you sure you want to leave the call?")),
            react_1.default.createElement(components_1.Flex, { display: "flex", py: 20 },
                react_1.default.createElement(components_1.Flex, { display: "flex", direction: "row", pt: 15, justify: "space-around" },
                    react_1.default.createElement(components_1.Button, { onClick: onClose },
                        react_1.default.createElement(components_1.Flex, { borderRadius: borderRadius_1.default.small, bg: "secondary.700", height: 40, width: modalButtonsWidth - 4, alignItems: "center", justifyContent: "center" },
                            react_1.default.createElement(components_1.Text, { fontSize: "lg" }, "Cancel"))),
                    react_1.default.createElement(components_1.Button, { onClick: onLeave },
                        react_1.default.createElement(components_1.Flex, { borderRadius: borderRadius_1.default.small, bg: "danger.500", height: 40, width: modalButtonsWidth - 4, alignItems: "center", justifyContent: "center" },
                            react_1.default.createElement(components_1.Text, { fontSize: "lg" }, "Leave")))),
                react_1.default.createElement(components_1.Flex, null, sessionConfig.permissions.kick_participant && (react_1.default.createElement(components_1.Button, { onClick: leaveRoomAndEndMeeting },
                    react_1.default.createElement(components_1.Flex, { display: "flex", direction: "row", mt: 15, justify: "space-around" },
                        react_1.default.createElement(components_1.Flex, { bg: "danger.500", height: 40, width: modalButtonsWidth * 2, alignItems: "center", justifyContent: "center" },
                            react_1.default.createElement(components_1.Text, { fontSize: "lg" }, "End Meeting"))))))))));
};
//# sourceMappingURL=ConfirmExitModal.js.map