import { EntrustType,EntrustMode } from './const';

import config from './config';

import handle from './handle';

export default {

    data:{},

    getEntrust(type,mode){

        mode = mode === undefined ? EntrustMode.list : mode;

        if (this.data[mode] === undefined) {
            this.data[mode] = {};
        }

        if (this.data[mode][type] === undefined) {
            this.data[mode][type] = new handle[mode](config[mode][type]);
        }

        return this.data[mode][type];
    }

}

export { EntrustType,EntrustMode }