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

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

  getDefaultAnchor(): any[] {
    const { id, x, y, width } = this;
    // 右侧锚点
    const rightAnchor = {
      x: x + width / 2,
      y,
      name: 'right',
      id: `${id}_right`,
    };
    return [rightAnchor];
  }
}
