"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapFileList = wrapFileList;
const _1 = require("../Class/$");
const MethodNotImplementedError_1 = require("../exception/MethodNotImplementedError");
const ObjectReadOnly_1 = require("../exception/ObjectReadOnly");
const File_1 = require("./File");
function wrapFileList(fileList, system) {
    const files = new (class Files_ extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['A'];
        }
        async append(a) {
            throw new ObjectReadOnly_1.ReadOnlyError('file list');
        }
        async put(i, data) {
            throw new ObjectReadOnly_1.ReadOnlyError('file list');
        }
        async at(i) {
            const fileItem = fileList.item(i);
            const file = (0, File_1.wrapFile)(fileItem, system);
            return file;
        }
        async length() {
            return fileList.length;
        }
        async indexOf(a) {
            let i = 0;
            while (i < fileList.length) {
                const file = fileList.item(i);
                if (file === a) {
                    return i;
                }
                i++;
            }
            return -1;
        }
        async pop() {
            throw new ObjectReadOnly_1.ReadOnlyError('file list');
        }
        async shift() {
            throw new MethodNotImplementedError_1.MethodNotImplementedError();
        }
    })(system);
    return files;
}
//# sourceMappingURL=FileList.js.map