// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function apiGatewayUsagePlanApiStagesThrottleToTerraform(struct) {
    if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) {
        return struct;
    }
    if (cdktf.isComplexElement(struct)) {
        throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration");
    }
    return {
        burst_limit: cdktf.numberToTerraform(struct.burstLimit),
        path: cdktf.stringToTerraform(struct.path),
        rate_limit: cdktf.numberToTerraform(struct.rateLimit),
    };
}
export function apiGatewayUsagePlanApiStagesToTerraform(struct) {
    if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) {
        return struct;
    }
    if (cdktf.isComplexElement(struct)) {
        throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration");
    }
    return {
        api_id: cdktf.stringToTerraform(struct.apiId),
        stage: cdktf.stringToTerraform(struct.stage),
        throttle: cdktf.listMapper(apiGatewayUsagePlanApiStagesThrottleToTerraform)(struct.throttle),
    };
}
export function apiGatewayUsagePlanQuotaSettingsToTerraform(struct) {
    if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) {
        return struct;
    }
    if (cdktf.isComplexElement(struct)) {
        throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration");
    }
    return {
        limit: cdktf.numberToTerraform(struct.limit),
        offset: cdktf.numberToTerraform(struct.offset),
        period: cdktf.stringToTerraform(struct.period),
    };
}
export class ApiGatewayUsagePlanQuotaSettingsOutputReference extends cdktf.ComplexObject {
    isEmptyObject = false;
    /**
    * @param terraformResource The parent resource
    * @param terraformAttribute The attribute on the parent resource this class is referencing
    * @param isSingleItem True if this is a block, false if it's a list
    */
    constructor(terraformResource, terraformAttribute, isSingleItem) {
        super(terraformResource, terraformAttribute, isSingleItem);
    }
    get internalValue() {
        let hasAnyValues = this.isEmptyObject;
        const internalValueResult = {};
        if (this._limit !== undefined) {
            hasAnyValues = true;
            internalValueResult.limit = this._limit;
        }
        if (this._offset !== undefined) {
            hasAnyValues = true;
            internalValueResult.offset = this._offset;
        }
        if (this._period !== undefined) {
            hasAnyValues = true;
            internalValueResult.period = this._period;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._limit = undefined;
            this._offset = undefined;
            this._period = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._limit = value.limit;
            this._offset = value.offset;
            this._period = value.period;
        }
    }
    // limit - computed: false, optional: false, required: true
    _limit;
    get limit() {
        return this.getNumberAttribute('limit');
    }
    set limit(value) {
        this._limit = value;
    }
    // Temporarily expose input value. Use with caution.
    get limitInput() {
        return this._limit;
    }
    // offset - computed: false, optional: true, required: false
    _offset;
    get offset() {
        return this.getNumberAttribute('offset');
    }
    set offset(value) {
        this._offset = value;
    }
    resetOffset() {
        this._offset = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get offsetInput() {
        return this._offset;
    }
    // period - computed: false, optional: false, required: true
    _period;
    get period() {
        return this.getStringAttribute('period');
    }
    set period(value) {
        this._period = value;
    }
    // Temporarily expose input value. Use with caution.
    get periodInput() {
        return this._period;
    }
}
export function apiGatewayUsagePlanThrottleSettingsToTerraform(struct) {
    if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) {
        return struct;
    }
    if (cdktf.isComplexElement(struct)) {
        throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration");
    }
    return {
        burst_limit: cdktf.numberToTerraform(struct.burstLimit),
        rate_limit: cdktf.numberToTerraform(struct.rateLimit),
    };
}
export class ApiGatewayUsagePlanThrottleSettingsOutputReference extends cdktf.ComplexObject {
    isEmptyObject = false;
    /**
    * @param terraformResource The parent resource
    * @param terraformAttribute The attribute on the parent resource this class is referencing
    * @param isSingleItem True if this is a block, false if it's a list
    */
    constructor(terraformResource, terraformAttribute, isSingleItem) {
        super(terraformResource, terraformAttribute, isSingleItem);
    }
    get internalValue() {
        let hasAnyValues = this.isEmptyObject;
        const internalValueResult = {};
        if (this._burstLimit !== undefined) {
            hasAnyValues = true;
            internalValueResult.burstLimit = this._burstLimit;
        }
        if (this._rateLimit !== undefined) {
            hasAnyValues = true;
            internalValueResult.rateLimit = this._rateLimit;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._burstLimit = undefined;
            this._rateLimit = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._burstLimit = value.burstLimit;
            this._rateLimit = value.rateLimit;
        }
    }
    // burst_limit - computed: false, optional: true, required: false
    _burstLimit;
    get burstLimit() {
        return this.getNumberAttribute('burst_limit');
    }
    set burstLimit(value) {
        this._burstLimit = value;
    }
    resetBurstLimit() {
        this._burstLimit = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get burstLimitInput() {
        return this._burstLimit;
    }
    // rate_limit - computed: false, optional: true, required: false
    _rateLimit;
    get rateLimit() {
        return this.getNumberAttribute('rate_limit');
    }
    set rateLimit(value) {
        this._rateLimit = value;
    }
    resetRateLimit() {
        this._rateLimit = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get rateLimitInput() {
        return this._rateLimit;
    }
}
/**
* Represents a {@link https://www.terraform.io/docs/providers/aws/r/api_gateway_usage_plan aws_api_gateway_usage_plan}
*/
export class ApiGatewayUsagePlan extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_api_gateway_usage_plan";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/api_gateway_usage_plan aws_api_gateway_usage_plan} Resource
    *
    * @param scope The scope in which to define this construct
    * @param id The scoped construct ID. Must be unique amongst siblings in the same scope
    * @param options ApiGatewayUsagePlanConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_api_gateway_usage_plan',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._description = config.description;
        this._name = config.name;
        this._productCode = config.productCode;
        this._tags = config.tags;
        this._tagsAll = config.tagsAll;
        this._apiStages = config.apiStages;
        this._quotaSettings.internalValue = config.quotaSettings;
        this._throttleSettings.internalValue = config.throttleSettings;
    }
    // ==========
    // ATTRIBUTES
    // ==========
    // arn - computed: true, optional: false, required: false
    get arn() {
        return this.getStringAttribute('arn');
    }
    // description - computed: false, optional: true, required: false
    _description;
    get description() {
        return this.getStringAttribute('description');
    }
    set description(value) {
        this._description = value;
    }
    resetDescription() {
        this._description = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get descriptionInput() {
        return this._description;
    }
    // id - computed: true, optional: true, required: false
    get id() {
        return this.getStringAttribute('id');
    }
    // name - computed: false, optional: false, required: true
    _name;
    get name() {
        return this.getStringAttribute('name');
    }
    set name(value) {
        this._name = value;
    }
    // Temporarily expose input value. Use with caution.
    get nameInput() {
        return this._name;
    }
    // product_code - computed: false, optional: true, required: false
    _productCode;
    get productCode() {
        return this.getStringAttribute('product_code');
    }
    set productCode(value) {
        this._productCode = value;
    }
    resetProductCode() {
        this._productCode = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get productCodeInput() {
        return this._productCode;
    }
    // tags - computed: false, optional: true, required: false
    _tags;
    get tags() {
        return this.getStringMapAttribute('tags');
    }
    set tags(value) {
        this._tags = value;
    }
    resetTags() {
        this._tags = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get tagsInput() {
        return this._tags;
    }
    // tags_all - computed: true, optional: true, required: false
    _tagsAll;
    get tagsAll() {
        return this.getStringMapAttribute('tags_all');
    }
    set tagsAll(value) {
        this._tagsAll = value;
    }
    resetTagsAll() {
        this._tagsAll = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get tagsAllInput() {
        return this._tagsAll;
    }
    // api_stages - computed: false, optional: true, required: false
    _apiStages;
    get apiStages() {
        // Getting the computed value is not yet implemented
        return cdktf.Token.asAny(cdktf.Fn.tolist(this.interpolationForAttribute('api_stages')));
    }
    set apiStages(value) {
        this._apiStages = value;
    }
    resetApiStages() {
        this._apiStages = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get apiStagesInput() {
        return this._apiStages;
    }
    // quota_settings - computed: false, optional: true, required: false
    _quotaSettings = new ApiGatewayUsagePlanQuotaSettingsOutputReference(this, "quota_settings", true);
    get quotaSettings() {
        return this._quotaSettings;
    }
    putQuotaSettings(value) {
        this._quotaSettings.internalValue = value;
    }
    resetQuotaSettings() {
        this._quotaSettings.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get quotaSettingsInput() {
        return this._quotaSettings.internalValue;
    }
    // throttle_settings - computed: false, optional: true, required: false
    _throttleSettings = new ApiGatewayUsagePlanThrottleSettingsOutputReference(this, "throttle_settings", true);
    get throttleSettings() {
        return this._throttleSettings;
    }
    putThrottleSettings(value) {
        this._throttleSettings.internalValue = value;
    }
    resetThrottleSettings() {
        this._throttleSettings.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get throttleSettingsInput() {
        return this._throttleSettings.internalValue;
    }
    // =========
    // SYNTHESIS
    // =========
    synthesizeAttributes() {
        return {
            description: cdktf.stringToTerraform(this._description),
            name: cdktf.stringToTerraform(this._name),
            product_code: cdktf.stringToTerraform(this._productCode),
            tags: cdktf.hashMapper(cdktf.stringToTerraform)(this._tags),
            tags_all: cdktf.hashMapper(cdktf.stringToTerraform)(this._tagsAll),
            api_stages: cdktf.listMapper(apiGatewayUsagePlanApiStagesToTerraform)(this._apiStages),
            quota_settings: apiGatewayUsagePlanQuotaSettingsToTerraform(this._quotaSettings.internalValue),
            throttle_settings: apiGatewayUsagePlanThrottleSettingsToTerraform(this._throttleSettings.internalValue),
        };
    }
}
//# sourceMappingURL=api-gateway-usage-plan.js.map