Source: package/connector/positioned_connector.js

import { Vector2, Vector3, Quaternion, Group, Mesh } from '../../../node_modules/three/build/three.module.js';
import { Reporter } from '../../reporter/reporter.js';
import { checkPropTypes } from '../../lib.js';
import { BuildableComponent } from '../component/buildable_component.js';
import { PositionedComponent } from '../component/positioned_component.js';
import { Block } from '../block/block.js';
import { PositionedBlock } from '../block/positioned_block.js';
import { Connector } from '../connector/connector.js';
import { Connection } from '../../configurator/connection.js';
import { WrappedTexture } from '../wrapped_texture.js';


/**
 * Helper class that is not imported from or exported to the package.json
 */


class PositionedConnector {

    /**
     * @param {Reporter} reporter
     * @param {Object} settings
     * @param {UUID} [settings.id]
     * @param {PositionedBlock} settings.positionedBlock
     * @param {Connector} settings.connector
     */

    constructor( reporter, settings ) {

        checkPropTypes(
            settings,
            {
                positionedBlock: PositionedBlock,
                connector: Connector
            },
            {}
        );


        // calc position
        // calc potential mates? this should be done by Configuration
        // set block

        // Het is niet onredelijk om PositionedBlock, PositionedConnector en Connection altijd toegang te geven tot Configuration (en daarmee Package),
        // omdat er geen enkele reden is om deze classes buiten een config te gebruiken. Bovendien is dit de enige manier waarop ze betekenisvol
        // werk kunnen doen. Een conection moet gewoon kunnen checken of alles klopt, niet alleen tussen de twee blocks, maar ook in de grotere omgeving.

    }

    static _exportName = {
        singular: 'positionedConnector',
        plural: 'positionedConnectors'
    };


    /** @type {Connection} */

    _connection;

    get connection() {
        return this._connection;
    }

    set connection( conn ) {
        if ( this._connection) {
            throw new Error('Already connected');
        }
        else if (!(conn instanceof Connection)) {
            throw new Error('Not a Connection type');
        }
        else {
            this._connection = conn;
        }
    }

};

export { PositionedConnector };