import { PDFArray, PDFBool, PDFDict, PDFName, PDFNumber, PDFString, } from "../..";
import { PDFAcroField } from './index';
var PDFAcroForm = /** @class */ (function () {
    function PDFAcroForm(dict) {
        this.dict = dict;
    }
    PDFAcroForm.fromDict = function (dict) {
        if (!dict.has(PDFName.of('Fields'))) {
            dict.set(PDFName.of('Fields'), dict.context.obj([]));
        }
        return new PDFAcroForm(dict);
    };
    PDFAcroForm.prototype.Fields = function () {
        var fieldDicts = this.dict
            .lookup(PDFName.of('Fields'), PDFArray)
            .lookupElements(PDFDict);
        var fields = new Array(fieldDicts.length);
        for (var idx = 0, len = fieldDicts.length; idx < len; idx++) {
            fields[idx] = PDFAcroField.fromDict(fieldDicts[idx]);
        }
        return fields;
    };
    PDFAcroForm.prototype.NeedsAppearances = function () {
        return this.dict.lookupMaybe(PDFName.of('NeedsAppearances'), PDFBool);
    };
    PDFAcroForm.prototype.SigFlags = function () {
        return this.dict.lookupMaybe(PDFName.of('SigFlags'), PDFNumber);
    };
    PDFAcroForm.prototype.DR = function () {
        return this.dict.lookupMaybe(PDFName.of('DR'), PDFDict);
    };
    PDFAcroForm.prototype.DA = function () {
        return this.dict.lookupMaybe(PDFName.of('DA'), PDFString);
    };
    PDFAcroForm.prototype.Q = function () {
        return this.dict.lookupMaybe(PDFName.of('Q'), PDFNumber);
    };
    PDFAcroForm.prototype.XFA = function () {
        return this.dict.lookup(PDFName.of('XFA'));
    };
    return PDFAcroForm;
}());
export default PDFAcroForm;
//# sourceMappingURL=PDFAcroForm.js.map