import { RectNode, RectNodeModel } from "@logicflow/core";
import { colors } from "../configs";

class FinishTaskModel extends RectNodeModel {
  initNodeData(data: any) {
    super.initNodeData(data);
    this.height = 30;
  }

  getNodeStyle() {
    const style = super.getNodeStyle();
    style.fill = colors.finish.background;
    style.stroke = colors.finish.border;
    style.strokeWidth = 1;
    return style;
  }
  getDefaultAnchor() {
    const { x, y, id } = this;
    return [
      {
        x: x,
        y: y + 15,
        name: "bottom",
        id: `${id}_0`
      },
      {
        x: x,
        y: y - 15,
        name: "top",
        id: `${id}_0`
      }
    ];
  }
}

class FinishTask extends RectNode {}

export default {
  type: "FinishTask",
  view: FinishTask,
  model: FinishTaskModel
};
