import { EventEmitter } from '@angular/core';
import { RotationBehavior } from '../rotation/rotation-behavior';
import { TranslationDirectionType } from '../translation/translation-direction-type';
import { TranslationBehavior } from '../translation/translation-behavior';
import { DynamicDisplayResultModel } from './dynamic-display-result-model';
import { DynamicBehaviorType } from './dynamic-behavior-type';
export class DynamicDisplay {
    constructor(dynamicDisplay, variableCommunicator, variableStore, location, signalRAppId) {
        this.doBehavior = new EventEmitter();
        if (dynamicDisplay.isHorizontalTranslation && dynamicDisplay.horizontalTranslation != null) {
            // tslint:disable-next-line:max-line-length
            const horizontalBehavior = new TranslationBehavior(dynamicDisplay.horizontalTranslation, variableCommunicator, variableStore, TranslationDirectionType.Horizontal, location, signalRAppId);
            horizontalBehavior.doTranslation.subscribe(tanslation => {
                // tslint:disable-next-line:max-line-length
                const dynamicDisplayResult = new DynamicDisplayResultModel(tanslation, undefined, DynamicBehaviorType.HorizontalTranslation);
                this.doBehavior.emit(dynamicDisplayResult);
            });
        }
        if (dynamicDisplay.isVerticalTranslation && dynamicDisplay.verticalTranslation != null) {
            // tslint:disable-next-line:max-line-length
            const verticalBehavior = new TranslationBehavior(dynamicDisplay.verticalTranslation, variableCommunicator, variableStore, TranslationDirectionType.Vertical, location, signalRAppId);
            verticalBehavior.doTranslation.subscribe(tanslation => {
                const dynamicDisplayResult = new DynamicDisplayResultModel(tanslation, undefined, DynamicBehaviorType.VerticalTranslation);
                this.doBehavior.emit(dynamicDisplayResult);
            });
        }
        if (dynamicDisplay.isRotation && dynamicDisplay.rotation != null) {
            const rotationBehavior = new RotationBehavior(dynamicDisplay.rotation, variableCommunicator, variableStore, signalRAppId);
            rotationBehavior.doRotation.subscribe(angel => {
                const dynamicDisplayResult = new DynamicDisplayResultModel(undefined, angel, DynamicBehaviorType.Rotation);
                this.doBehavior.emit(dynamicDisplayResult);
            });
        }
    }
}
