import * as d3 from 'd3';

import { Node } from './node';

export class Link implements d3.SimulationLinkDatum<Node> {
  source: Node;
  target: Node;

  index?: number;

  constructor(source: Node, target: Node) {
    target.addLink(this);

    if ('zone' !== source.group) {
      source.addLink(this);
    }

    this.source = source;
    this.target = target;
  }
}
