import { assert } from "../../core/assert.js";

export class VisualTip {
    /**
     *
     * @param {Rectangle} target
     * @param {function} tipFactory
     * @param {*} [factoryContext]
     * @param {Rectangle[]} [obstacles]
     */
    constructor(target, tipFactory, factoryContext, obstacles = []) {
        assert.defined(target, 'target');
        assert.notNull(target, 'target');

        assert.isFunction(tipFactory, 'tipFactory')

        assert.defined(obstacles, 'obstacles');
        assert.isArray(obstacles, 'obstacles');


        /**
         *
         * @type {Rectangle}
         */
        this.target = target;
        /**
         *
         * @type {Function}
         */
        this.factory = tipFactory;

        /**
         *
         * @type {*}
         */
        this.factoryContext = factoryContext;

        /**
         *
         * @type {Rectangle[]}
         */
        this.obstracles = obstacles;

        /**
         *
         * @type {View|null}
         */
        this.view = null;
    }
}
