"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "AlgoOrderBadge", {
    enumerable: true,
    get: function() {
        return AlgoOrderBadge;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _types = require("@orderly.network/types");
const _tag = require("../../tag");
const AlgoOrderBadge = (props)=>{
    const positionBadge = (0, _react.useMemo)(()=>{
        if (props.order.algo_type !== _types.AlgoOrderRootType.POSITIONAL_TP_SL) {
            return null;
        }
        return /*#__PURE__*/ (0, _jsxruntime.jsx)(_tag.Tag, {
            className: "orderly-text-primary orderly-bg-primary/10",
            children: "Position"
        });
    }, [
        props.order.algo_type
    ]);
    const tpslBadge = (0, _react.useMemo)(()=>{
        const tpOrder = props.order.child_orders.find((order)=>order.algo_type === _types.AlgoOrderType.TAKE_PROFIT && !!order.trigger_price);
        const slOrder = props.order.child_orders.find((order)=>order.algo_type === _types.AlgoOrderType.STOP_LOSS && !!order.trigger_price);
        if (!tpOrder && !slOrder) {
            return null;
        }
        return /*#__PURE__*/ (0, _jsxruntime.jsx)(_tag.Tag, {
            className: "orderly-text-base-contrast-36 orderly-bg-white/10",
            children: tpOrder && slOrder ? "TP/SL" : tpOrder ? "TP" : "SL"
        });
    }, [
        props.order.child_orders
    ]);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: "orderly-flex orderly-gap-1 orderly-text-3xs orderly-td-bg-transparent orderly-h-[18px]",
        children: [
            positionBadge,
            " ",
            tpslBadge
        ]
    });
};

//# sourceMappingURL=algoOrderTypeBadge.js.map