"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StringParameterBuilder = exports.StringCommandParameter = void 0;
const yok_1 = require("./yok");
class StringCommandParameter {
    constructor($injector) {
        this.$injector = $injector;
        this.mandatory = false;
    }
    async validate(validationValue) {
        if (!validationValue) {
            if (this.errorMessage) {
                this.$injector.resolve("errors").fail(this.errorMessage);
            }
            return false;
        }
        return true;
    }
}
exports.StringCommandParameter = StringCommandParameter;
yok_1.injector.register("stringParameter", StringCommandParameter);
class StringParameterBuilder {
    constructor($injector) {
        this.$injector = $injector;
    }
    createMandatoryParameter(errorMsg) {
        const commandParameter = new StringCommandParameter(this.$injector);
        commandParameter.mandatory = true;
        commandParameter.errorMessage = errorMsg;
        return commandParameter;
    }
}
exports.StringParameterBuilder = StringParameterBuilder;
yok_1.injector.register("stringParameterBuilder", StringParameterBuilder);
