// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function backupPlanAdvancedBackupSettingToTerraform(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 {
        backup_options: cdktf.hashMapper(cdktf.stringToTerraform)(struct.backupOptions),
        resource_type: cdktf.stringToTerraform(struct.resourceType),
    };
}
export function backupPlanRuleCopyActionLifecycleToTerraform(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 {
        cold_storage_after: cdktf.numberToTerraform(struct.coldStorageAfter),
        delete_after: cdktf.numberToTerraform(struct.deleteAfter),
    };
}
export class BackupPlanRuleCopyActionLifecycleOutputReference 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._coldStorageAfter !== undefined) {
            hasAnyValues = true;
            internalValueResult.coldStorageAfter = this._coldStorageAfter;
        }
        if (this._deleteAfter !== undefined) {
            hasAnyValues = true;
            internalValueResult.deleteAfter = this._deleteAfter;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._coldStorageAfter = undefined;
            this._deleteAfter = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._coldStorageAfter = value.coldStorageAfter;
            this._deleteAfter = value.deleteAfter;
        }
    }
    // cold_storage_after - computed: false, optional: true, required: false
    _coldStorageAfter;
    get coldStorageAfter() {
        return this.getNumberAttribute('cold_storage_after');
    }
    set coldStorageAfter(value) {
        this._coldStorageAfter = value;
    }
    resetColdStorageAfter() {
        this._coldStorageAfter = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get coldStorageAfterInput() {
        return this._coldStorageAfter;
    }
    // delete_after - computed: false, optional: true, required: false
    _deleteAfter;
    get deleteAfter() {
        return this.getNumberAttribute('delete_after');
    }
    set deleteAfter(value) {
        this._deleteAfter = value;
    }
    resetDeleteAfter() {
        this._deleteAfter = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get deleteAfterInput() {
        return this._deleteAfter;
    }
}
export function backupPlanRuleCopyActionToTerraform(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 {
        destination_vault_arn: cdktf.stringToTerraform(struct.destinationVaultArn),
        lifecycle: backupPlanRuleCopyActionLifecycleToTerraform(struct.lifecycle),
    };
}
export function backupPlanRuleLifecycleToTerraform(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 {
        cold_storage_after: cdktf.numberToTerraform(struct.coldStorageAfter),
        delete_after: cdktf.numberToTerraform(struct.deleteAfter),
    };
}
export class BackupPlanRuleLifecycleOutputReference 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._coldStorageAfter !== undefined) {
            hasAnyValues = true;
            internalValueResult.coldStorageAfter = this._coldStorageAfter;
        }
        if (this._deleteAfter !== undefined) {
            hasAnyValues = true;
            internalValueResult.deleteAfter = this._deleteAfter;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._coldStorageAfter = undefined;
            this._deleteAfter = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._coldStorageAfter = value.coldStorageAfter;
            this._deleteAfter = value.deleteAfter;
        }
    }
    // cold_storage_after - computed: false, optional: true, required: false
    _coldStorageAfter;
    get coldStorageAfter() {
        return this.getNumberAttribute('cold_storage_after');
    }
    set coldStorageAfter(value) {
        this._coldStorageAfter = value;
    }
    resetColdStorageAfter() {
        this._coldStorageAfter = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get coldStorageAfterInput() {
        return this._coldStorageAfter;
    }
    // delete_after - computed: false, optional: true, required: false
    _deleteAfter;
    get deleteAfter() {
        return this.getNumberAttribute('delete_after');
    }
    set deleteAfter(value) {
        this._deleteAfter = value;
    }
    resetDeleteAfter() {
        this._deleteAfter = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get deleteAfterInput() {
        return this._deleteAfter;
    }
}
export function backupPlanRuleToTerraform(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 {
        completion_window: cdktf.numberToTerraform(struct.completionWindow),
        enable_continuous_backup: cdktf.booleanToTerraform(struct.enableContinuousBackup),
        recovery_point_tags: cdktf.hashMapper(cdktf.stringToTerraform)(struct.recoveryPointTags),
        rule_name: cdktf.stringToTerraform(struct.ruleName),
        schedule: cdktf.stringToTerraform(struct.schedule),
        start_window: cdktf.numberToTerraform(struct.startWindow),
        target_vault_name: cdktf.stringToTerraform(struct.targetVaultName),
        copy_action: cdktf.listMapper(backupPlanRuleCopyActionToTerraform)(struct.copyAction),
        lifecycle: backupPlanRuleLifecycleToTerraform(struct.lifecycle),
    };
}
/**
* Represents a {@link https://www.terraform.io/docs/providers/aws/r/backup_plan aws_backup_plan}
*/
export class BackupPlan extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_backup_plan";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/backup_plan aws_backup_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 BackupPlanConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_backup_plan',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._name = config.name;
        this._tags = config.tags;
        this._tagsAll = config.tagsAll;
        this._advancedBackupSetting = config.advancedBackupSetting;
        this._rule = config.rule;
    }
    // ==========
    // ATTRIBUTES
    // ==========
    // arn - computed: true, optional: false, required: false
    get arn() {
        return this.getStringAttribute('arn');
    }
    // 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;
    }
    // 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;
    }
    // version - computed: true, optional: false, required: false
    get version() {
        return this.getStringAttribute('version');
    }
    // advanced_backup_setting - computed: false, optional: true, required: false
    _advancedBackupSetting;
    get advancedBackupSetting() {
        // Getting the computed value is not yet implemented
        return cdktf.Token.asAny(cdktf.Fn.tolist(this.interpolationForAttribute('advanced_backup_setting')));
    }
    set advancedBackupSetting(value) {
        this._advancedBackupSetting = value;
    }
    resetAdvancedBackupSetting() {
        this._advancedBackupSetting = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get advancedBackupSettingInput() {
        return this._advancedBackupSetting;
    }
    // rule - computed: false, optional: false, required: true
    _rule;
    get rule() {
        // Getting the computed value is not yet implemented
        return cdktf.Token.asAny(cdktf.Fn.tolist(this.interpolationForAttribute('rule')));
    }
    set rule(value) {
        this._rule = value;
    }
    // Temporarily expose input value. Use with caution.
    get ruleInput() {
        return this._rule;
    }
    // =========
    // SYNTHESIS
    // =========
    synthesizeAttributes() {
        return {
            name: cdktf.stringToTerraform(this._name),
            tags: cdktf.hashMapper(cdktf.stringToTerraform)(this._tags),
            tags_all: cdktf.hashMapper(cdktf.stringToTerraform)(this._tagsAll),
            advanced_backup_setting: cdktf.listMapper(backupPlanAdvancedBackupSettingToTerraform)(this._advancedBackupSetting),
            rule: cdktf.listMapper(backupPlanRuleToTerraform)(this._rule),
        };
    }
}
//# sourceMappingURL=backup-plan.js.map