import wn from '../../../../../node_modules/preact/compat/dist/compat.module.mjs';
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 { useState as h } from '../../../../../node_modules/preact/hooks/dist/hooks.module.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] = h(false);
    return /*#__PURE__*/ wn.createElement(FlexBox, {
        flexDirection: "column",
        gap: 3
    }, /*#__PURE__*/ wn.createElement(Typography, {
        variant: "h2"
    }, "Configure ", connectionDisplayName), /*#__PURE__*/ wn.createElement("div", null, /*#__PURE__*/ wn.createElement(Accordion, {
        defaultExpanded: defaultExpanded
    }, /*#__PURE__*/ wn.createElement(AccordionSummaryCore, null, /*#__PURE__*/ wn.createElement(Typography, null, copyToIdpLabel)), /*#__PURE__*/ wn.createElement(AccordionDetails, null, /*#__PURE__*/ wn.createElement(FlexBox, {
        flexDirection: "column",
        gap: 2
    }, /*#__PURE__*/ wn.createElement(SCIMFields, {
        fields: copyToIdpFields,
        connection: connection
    }), /*#__PURE__*/ wn.createElement(Checkbox, {
        label: "I have copied the above values to my IdP.",
        checked: hasUserConfirmedCopyToIdp,
        onClick: (value)=>setHasUserConfirmedCopyToIdp(value)
    })))), confirmFields && /*#__PURE__*/ wn.createElement(Accordion, null, /*#__PURE__*/ wn.createElement(AccordionSummaryCore, null, /*#__PURE__*/ wn.createElement(Typography, null, confirmLabel)), /*#__PURE__*/ wn.createElement(AccordionDetails, null, /*#__PURE__*/ wn.createElement(FlexBox, {
        flexDirection: "column",
        gap: 2
    }, /*#__PURE__*/ wn.createElement(SCIMFields, {
        fields: confirmFields,
        connection: connection
    }))))), /*#__PURE__*/ wn.createElement(Button, {
        disabled: !hasUserConfirmedCopyToIdp,
        onClick: ()=>{
            navigate({
                screen: 'scimConnection'
            });
        }
    }, "Done"));
};

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