import { __extends } from "tslib";
import { FieldModel } from '../models';
import { BasicBuilder } from './basic';
import { or } from '../maybe';
var FieldBuilder = (function (_super) {
    __extends(FieldBuilder, _super);
    function FieldBuilder(_defaultValue) {
        var _this = _super.call(this) || this;
        _this._defaultValue = _defaultValue;
        return _this;
    }
    FieldBuilder.prototype.build = function (defaultValue) {
        var _this = this;
        var model = new FieldModel(or(defaultValue, function () { return _this._defaultValue; }));
        model.validators = this._validators;
        model.normalizeBeforeSubmit = this._normalizeBeforeSubmit;
        model.builder = this;
        return model;
    };
    return FieldBuilder;
}(BasicBuilder));
export { FieldBuilder };
