import { I18N } from 'aurelia-i18n';
import { autoinject, Container } from 'aurelia-framework';
import { FloatingBoxViewModel } from './floating-box';

@autoinject
export class HistoryViewBox extends FloatingBoxViewModel {
    public entityId: number
    public entityName: string;
    private entity: any;
    private i18n: I18N;

    public getTitle(): string {
        return this.i18n.tr('common:history.history');
    }

    constructor(entity: any) {
        super('./history-view-box.html')
        this.entity = entity;
        this.i18n = Container.instance.get(I18N);
    }

    public async activate(config: any) {
        await super.activate(config);
        this.entityId = this.entity.id;
        this.entityName = this.entity.entityType.shortName;
    }
}
