import { assert } from "../../../../core/assert.js";
import { noop } from "../../../../core/function/noop.js";
import { returnTrue } from "../../../../core/function/returnTrue.js";

export class VisibilityFilter {
    constructor({
                    name,
                    objectPredicateInitialize = noop,
                    objectPredicateFinalize = noop,
                    objectPredicateExecute = returnTrue,
                    layerPredicate = returnTrue
                }) {

        assert.isString(name, 'name');

        /**
         * @type {string}
         */
        this.name = name;

        this.objectPredicateExecute = objectPredicateExecute;
        this.objectPredicateInitialize = objectPredicateInitialize;
        this.objectPredicateFinalize = objectPredicateFinalize;

        /**
         *
         * @type {function(RenderLayer): boolean}
         */
        this.layerPredicate = layerPredicate;

        /**
         *
         * @type {boolean}
         */
        this.enabled = true;
    }
}
