import ngModule from '../../module';
import Component from 'core/lib/component';

class Controller extends Component {
    set alias(value) {
        this._alias = value;
        this.$.summary = null;
        if (!value) return;

        this.$http.get(`MailAliases/${value.id}`)
            .then(res => this.$.summary = res.data);
    }

    get alias() {
        return this._alias;
    }
}

ngModule.component('vnAliasSummary', {
    template: require('./index.html'),
    controller: Controller,
    bindings: {
        alias: '<'
    }
});