import React__default, { useState } from 'react';
import { AccordionSummaryCore } from '../shared/components/Accordion.mjs';
import { Button } from '../components/Button.mjs';
import { Checkbox } from '../components/Checkbox.mjs';
import { FlexBox } from '../shared/components/FlexBox.mjs';
import { SCIMFields } from '../components/ScimFields.mjs';
import { Typography } from '../components/Typography.mjs';
import { getSCIMIdpInfo } from './scimInfo.mjs';
import { useScimRouterController } from './SCIMRouter.mjs';
import Accordion from '../../../../../node_modules/@mui/material/Accordion/Accordion.mjs';
import AccordionDetails from '../../../../../node_modules/@mui/material/AccordionDetails/AccordionDetails.mjs';

const SCIMNewConnectionConfigureScreen = ({ connection })=>{
    const { navigate } = useScimRouterController();
    const { copyToIdpLabel, copyToIdpFields, confirmLabel, confirmFields } = getSCIMIdpInfo(connection.identity_provider);
    const connectionDisplayName = connection.display_name;
    const defaultExpanded = confirmFields === undefined;
    const [hasUserConfirmedCopyToIdp, setHasUserConfirmedCopyToIdp] = useState(false);
    return /*#__PURE__*/ React__default.createElement(FlexBox, {
        flexDirection: "column",
        gap: 3
    }, /*#__PURE__*/ React__default.createElement(Typography, {
        variant: "h2"
    }, "Configure ", connectionDisplayName), /*#__PURE__*/ React__default.createElement("div", null, /*#__PURE__*/ React__default.createElement(Accordion, {
        defaultExpanded: defaultExpanded
    }, /*#__PURE__*/ React__default.createElement(AccordionSummaryCore, null, /*#__PURE__*/ React__default.createElement(Typography, null, copyToIdpLabel)), /*#__PURE__*/ React__default.createElement(AccordionDetails, null, /*#__PURE__*/ React__default.createElement(FlexBox, {
        flexDirection: "column",
        gap: 2
    }, /*#__PURE__*/ React__default.createElement(SCIMFields, {
        fields: copyToIdpFields,
        connection: connection
    }), /*#__PURE__*/ React__default.createElement(Checkbox, {
        label: "I have copied the above values to my IdP.",
        checked: hasUserConfirmedCopyToIdp,
        onClick: (value)=>setHasUserConfirmedCopyToIdp(value)
    })))), confirmFields && /*#__PURE__*/ React__default.createElement(Accordion, null, /*#__PURE__*/ React__default.createElement(AccordionSummaryCore, null, /*#__PURE__*/ React__default.createElement(Typography, null, confirmLabel)), /*#__PURE__*/ React__default.createElement(AccordionDetails, null, /*#__PURE__*/ React__default.createElement(FlexBox, {
        flexDirection: "column",
        gap: 2
    }, /*#__PURE__*/ React__default.createElement(SCIMFields, {
        fields: confirmFields,
        connection: connection
    }))))), /*#__PURE__*/ React__default.createElement(Button, {
        disabled: !hasUserConfirmedCopyToIdp,
        onClick: ()=>{
            navigate({
                screen: 'scimConnection'
            });
        }
    }, "Done"));
};

export { SCIMNewConnectionConfigureScreen };
//# sourceMappingURL=SCIMNewConnectionConfigureScreen.mjs.map
