"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stack_1 = require("./stack");
/**
 * Use the optional Parameters section to customize your templates.
 * Parameters enable you to input custom values to your template each time you create or
 * update a stack.
 */
class Parameter extends stack_1.Referenceable {
    /**
     * Creates a parameter construct.
     * Note that the name (logical ID) of the parameter will derive from it's `coname` and location
     * within the stack. Therefore, it is recommended that parameters are defined at the stack level.
     *
     * @param parent The parent construct.
     * @param props The parameter properties.
     */
    constructor(parent, name, props) {
        super(parent, name);
        this.properties = props;
        this.value = this.ref;
    }
    toCloudFormation() {
        return {
            Parameters: {
                [this.logicalId]: {
                    Type: this.properties.type,
                    Default: this.properties.default,
                    AllowedPattern: this.properties.allowedPattern,
                    AllowedValues: this.properties.allowedValues,
                    ConstraintDescription: this.properties.constraintDescription,
                    Description: this.properties.description,
                    MaxLength: this.properties.maxLength,
                    MaxValue: this.properties.maxValue,
                    MinLength: this.properties.minLength,
                    MinValue: this.properties.minValue,
                    NoEcho: this.properties.noEcho
                }
            }
        };
    }
    /**
     * Allows using parameters as tokens without the need to dereference them.
     * This implicitly implements Token, until we make it an interface.
     */
    resolve() {
        return this.value;
    }
}
exports.Parameter = Parameter;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyYW1ldGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicGFyYW1ldGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsbUNBQXdDO0FBaUV4Qzs7OztHQUlHO0FBQ0gsTUFBYSxTQUFVLFNBQVEscUJBQWE7SUFReEM7Ozs7Ozs7T0FPRztJQUNILFlBQVksTUFBaUIsRUFBRSxJQUFZLEVBQUUsS0FBcUI7UUFDOUQsS0FBSyxDQUFDLE1BQU0sRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNwQixJQUFJLENBQUMsVUFBVSxHQUFHLEtBQUssQ0FBQztRQUN4QixJQUFJLENBQUMsS0FBSyxHQ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