const Q = require('./q'),
    nedbCollection = require('nedbCollection'),
    taskStatus = require('taskStatus');
class upload {
    constructor() {
        this.nedb = new nedbCollection('folder.d');
    }
    remove(_id) {
        return this.nedb.delete({ '_id': _id });
    }
    nextTask() {
        return this.nedb.findOne({});
    }
    clear() {
        return this.nedb.delete({});
    }
    count() {
        return this.nedb.count({});
    }
    add(paths, pid = '0') {
        if (!paths) {
            return Q((resolve, reject) => { resolve(false); });
        }
        if (!Array.isArray(paths))
            return this.nedb.insert({ path: paths, pid: pid });
        return this.nedb.insert(paths.map(v => ({ path: v, pid: pid })));
    }
}
module.exports = upload;