"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepStrategySelectionButtonGroup = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const core_1 = require("@material-ui/core");
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
const BaseFlowRuleStep_1 = require("@appglue/common/dist/Flow/Steps/Rules/BaseFlowRuleStep");
const TextStyleButton = (0, styled_components_1.default)(core_1.Button) `
    && {
        height: 46px;
        padding: 0 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: solid 1px #e6e9ed;
        border-radius: 4px;

        &:hover {
            background: #f2fafe;
        }

        &.Mui-disabled {
            background: #f2fafe;
        }
    }
`;
const StyledInputLabel = (0, styled_components_1.default)(core_1.InputLabel) `
    && {
        margin-bottom: 0px;
    }
`;
const StepStrategySelectionButtonGroup = (props) => {
    function handleChangeRuleStepStragy(newStyle) {
        if (props.parentDefaultValue && newStyle === props.parentDefaultValue) {
            Reflect.set(props.editObject, props.propertyName, null);
        }
        else {
            Reflect.set(props.editObject, props.propertyName, newStyle);
        }
        props.updateCallback();
    }
    const value = Reflect.get(props.editObject, props.propertyName) ?? props.parentDefaultValue;
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [props.label && (0, jsx_runtime_1.jsx)(StyledInputLabel, { children: props.label }), (0, jsx_runtime_1.jsxs)(core_1.ButtonGroup, { size: "large", "aria-label": "large outlined primary button group", style: { height: "49px", width: "240px", marginTop: "10px" }, children: [(0, jsx_runtime_1.jsx)(TextStyleButton, { onClick: () => {
                            handleChangeRuleStepStragy(BaseFlowRuleStep_1.RuleStepStrategy.Paths);
                        }, disabled: value === BaseFlowRuleStep_1.RuleStepStrategy.Paths, children: BaseFlowRuleStep_1.RuleStepStrategy.Paths }), (0, jsx_runtime_1.jsx)(TextStyleButton, { onClick: () => {
                            handleChangeRuleStepStragy(BaseFlowRuleStep_1.RuleStepStrategy.Value);
                        }, disabled: value === BaseFlowRuleStep_1.RuleStepStrategy.Value, children: BaseFlowRuleStep_1.RuleStepStrategy.Value })] })] }));
};
exports.StepStrategySelectionButtonGroup = StepStrategySelectionButtonGroup;
//# sourceMappingURL=StepStrategySelectionButtonGroup.js.map