import BaseNodeModel from '../base/baseNodeModel';

export class EndNodeModel extends BaseNodeModel {
  // 连线规则-作为起点-都不允许连线
  getConnectedSourceRules() {
    const rules = super.getConnectedSourceRules();
    const notAsTarget = {
      message: '不能连出',
      validate: () => false,
    };
    rules.push(notAsTarget);
    return rules;
  }

  getDefaultAnchor(): any[] {
    const { id, x, y, width } = this;
    // 左侧锚点
    const leftAnchor = {
      x: x - width / 2,
      y,
      name: 'left',
      id: `${id}_left`,
    };
    return [leftAnchor];
  }
}
