// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function appsyncFunctionSyncConfigLambdaConflictHandlerConfigToTerraform(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 {
        lambda_conflict_handler_arn: cdktf.stringToTerraform(struct.lambdaConflictHandlerArn),
    };
}
export class AppsyncFunctionSyncConfigLambdaConflictHandlerConfigOutputReference 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._lambdaConflictHandlerArn !== undefined) {
            hasAnyValues = true;
            internalValueResult.lambdaConflictHandlerArn = this._lambdaConflictHandlerArn;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._lambdaConflictHandlerArn = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._lambdaConflictHandlerArn = value.lambdaConflictHandlerArn;
        }
    }
    // lambda_conflict_handler_arn - computed: false, optional: true, required: false
    _lambdaConflictHandlerArn;
    get lambdaConflictHandlerArn() {
        return this.getStringAttribute('lambda_conflict_handler_arn');
    }
    set lambdaConflictHandlerArn(value) {
        this._lambdaConflictHandlerArn = value;
    }
    resetLambdaConflictHandlerArn() {
        this._lambdaConflictHandlerArn = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get lambdaConflictHandlerArnInput() {
        return this._lambdaConflictHandlerArn;
    }
}
export function appsyncFunctionSyncConfigToTerraform(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 {
        conflict_detection: cdktf.stringToTerraform(struct.conflictDetection),
        conflict_handler: cdktf.stringToTerraform(struct.conflictHandler),
        lambda_conflict_handler_config: appsyncFunctionSyncConfigLambdaConflictHandlerConfigToTerraform(struct.lambdaConflictHandlerConfig),
    };
}
export class AppsyncFunctionSyncConfigOutputReference 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._conflictDetection !== undefined) {
            hasAnyValues = true;
            internalValueResult.conflictDetection = this._conflictDetection;
        }
        if (this._conflictHandler !== undefined) {
            hasAnyValues = true;
            internalValueResult.conflictHandler = this._conflictHandler;
        }
        if (this._lambdaConflictHandlerConfig?.internalValue !== undefined) {
            hasAnyValues = true;
            internalValueResult.lambdaConflictHandlerConfig = this._lambdaConflictHandlerConfig?.internalValue;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._conflictDetection = undefined;
            this._conflictHandler = undefined;
            this._lambdaConflictHandlerConfig.internalValue = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._conflictDetection = value.conflictDetection;
            this._conflictHandler = value.conflictHandler;
            this._lambdaConflictHandlerConfig.internalValue = value.lambdaConflictHandlerConfig;
        }
    }
    // conflict_detection - computed: false, optional: true, required: false
    _conflictDetection;
    get conflictDetection() {
        return this.getStringAttribute('conflict_detection');
    }
    set conflictDetection(value) {
        this._conflictDetection = value;
    }
    resetConflictDetection() {
        this._conflictDetection = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get conflictDetectionInput() {
        return this._conflictDetection;
    }
    // conflict_handler - computed: false, optional: true, required: false
    _conflictHandler;
    get conflictHandler() {
        return this.getStringAttribute('conflict_handler');
    }
    set conflictHandler(value) {
        this._conflictHandler = value;
    }
    resetConflictHandler() {
        this._conflictHandler = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get conflictHandlerInput() {
        return this._conflictHandler;
    }
    // lambda_conflict_handler_config - computed: false, optional: true, required: false
    _lambdaConflictHandlerConfig = new AppsyncFunctionSyncConfigLambdaConflictHandlerConfigOutputReference(this, "lambda_conflict_handler_config", true);
    get lambdaConflictHandlerConfig() {
        return this._lambdaConflictHandlerConfig;
    }
    putLambdaConflictHandlerConfig(value) {
        this._lambdaConflictHandlerConfig.internalValue = value;
    }
    resetLambdaConflictHandlerConfig() {
        this._lambdaConflictHandlerConfig.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get lambdaConflictHandlerConfigInput() {
        return this._lambdaConflictHandlerConfig.internalValue;
    }
}
/**
* Represents a {@link https://www.terraform.io/docs/providers/aws/r/appsync_function aws_appsync_function}
*/
export class AppsyncFunction extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_appsync_function";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/appsync_function aws_appsync_function} 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 AppsyncFunctionConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_appsync_function',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._apiId = config.apiId;
        this._dataSource = config.dataSource;
        this._description = config.description;
        this._functionVersion = config.functionVersion;
        this._maxBatchSize = config.maxBatchSize;
        this._name = config.name;
        this._requestMappingTemplate = config.requestMappingTemplate;
        this._responseMappingTemplate = config.responseMappingTemplate;
        this._syncConfig.internalValue = config.syncConfig;
    }
    // ==========
    // ATTRIBUTES
    // ==========
    // api_id - computed: false, optional: false, required: true
    _apiId;
    get apiId() {
        return this.getStringAttribute('api_id');
    }
    set apiId(value) {
        this._apiId = value;
    }
    // Temporarily expose input value. Use with caution.
    get apiIdInput() {
        return this._apiId;
    }
    // arn - computed: true, optional: false, required: false
    get arn() {
        return this.getStringAttribute('arn');
    }
    // data_source - computed: false, optional: false, required: true
    _dataSource;
    get dataSource() {
        return this.getStringAttribute('data_source');
    }
    set dataSource(value) {
        this._dataSource = value;
    }
    // Temporarily expose input value. Use with caution.
    get dataSourceInput() {
        return this._dataSource;
    }
    // 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;
    }
    // function_id - computed: true, optional: false, required: false
    get functionId() {
        return this.getStringAttribute('function_id');
    }
    // function_version - computed: false, optional: true, required: false
    _functionVersion;
    get functionVersion() {
        return this.getStringAttribute('function_version');
    }
    set functionVersion(value) {
        this._functionVersion = value;
    }
    resetFunctionVersion() {
        this._functionVersion = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get functionVersionInput() {
        return this._functionVersion;
    }
    // id - computed: true, optional: true, required: false
    get id() {
        return this.getStringAttribute('id');
    }
    // max_batch_size - computed: false, optional: true, required: false
    _maxBatchSize;
    get maxBatchSize() {
        return this.getNumberAttribute('max_batch_size');
    }
    set maxBatchSize(value) {
        this._maxBatchSize = value;
    }
    resetMaxBatchSize() {
        this._maxBatchSize = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get maxBatchSizeInput() {
        return this._maxBatchSize;
    }
    // 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;
    }
    // request_mapping_template - computed: false, optional: false, required: true
    _requestMappingTemplate;
    get requestMappingTemplate() {
        return this.getStringAttribute('request_mapping_template');
    }
    set requestMappingTemplate(value) {
        this._requestMappingTemplate = value;
    }
    // Temporarily expose input value. Use with caution.
    get requestMappingTemplateInput() {
        return this._requestMappingTemplate;
    }
    // response_mapping_template - computed: false, optional: false, required: true
    _responseMappingTemplate;
    get responseMappingTemplate() {
        return this.getStringAttribute('response_mapping_template');
    }
    set responseMappingTemplate(value) {
        this._responseMappingTemplate = value;
    }
    // Temporarily expose input value. Use with caution.
    get responseMappingTemplateInput() {
        return this._responseMappingTemplate;
    }
    // sync_config - computed: false, optional: true, required: false
    _syncConfig = new AppsyncFunctionSyncConfigOutputReference(this, "sync_config", true);
    get syncConfig() {
        return this._syncConfig;
    }
    putSyncConfig(value) {
        this._syncConfig.internalValue = value;
    }
    resetSyncConfig() {
        this._syncConfig.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get syncConfigInput() {
        return this._syncConfig.internalValue;
    }
    // =========
    // SYNTHESIS
    // =========
    synthesizeAttributes() {
        return {
            api_id: cdktf.stringToTerraform(this._apiId),
            data_source: cdktf.stringToTerraform(this._dataSource),
            description: cdktf.stringToTerraform(this._description),
            function_version: cdktf.stringToTerraform(this._functionVersion),
            max_batch_size: cdktf.numberToTerraform(this._maxBatchSize),
            name: cdktf.stringToTerraform(this._name),
            request_mapping_template: cdktf.stringToTerraform(this._requestMappingTemplate),
            response_mapping_template: cdktf.stringToTerraform(this._responseMappingTemplate),
            sync_config: appsyncFunctionSyncConfigToTerraform(this._syncConfig.internalValue),
        };
    }
}
//# sourceMappingURL=appsync-function.js.map