import { BezierEdge, BezierEdgeModel, GraphModel } from '@logicflow/core';
import { storeToRefs } from 'pinia';
import { useThemeConfig } from '/@/stores/themeConfig';
const storesThemeConfig = useThemeConfig();
const { themeConfig } = storeToRefs(storesThemeConfig);
class TransitionModel extends BezierEdgeModel {
    static extendKey = 'ReturnTransitionModel';
    constructor(data: any, graphModel: GraphModel) {
        data.text = '退回';
        super(data, graphModel)
        this.properties.isPrevious = true;
    }
    getEdgeStyle(): {
        [x: string]: any;
        fill?: string;
        stroke?: string;
        strokeWidth?: number;
    } {
        const style = super.getEdgeStyle()
        style.stroke = "#FF0000";
        return style
    }
    getTextStyle() {
        const style = super.getTextStyle();
        style.color = "#FF0000";
        if (themeConfig.value.isIsDark) { // @ts-ignore
            style.background.fill = "transparent";
        }
        return style;
    }
}

class TransitionView extends BezierEdge {
    static extendKey = 'TransitionEdge';
}

const Transition = {
    type: 'hotline:returnTransition',
    view: TransitionView,
    model: TransitionModel
}

export { TransitionView, TransitionModel }
export default Transition
