// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function appsyncResolverCachingConfigToTerraform(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 {
        caching_keys: cdktf.listMapper(cdktf.stringToTerraform)(struct.cachingKeys),
        ttl: cdktf.numberToTerraform(struct.ttl),
    };
}
export class AppsyncResolverCachingConfigOutputReference 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._cachingKeys !== undefined) {
            hasAnyValues = true;
            internalValueResult.cachingKeys = this._cachingKeys;
        }
        if (this._ttl !== undefined) {
            hasAnyValues = true;
            internalValueResult.ttl = this._ttl;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._cachingKeys = undefined;
            this._ttl = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._cachingKeys = value.cachingKeys;
            this._ttl = value.ttl;
        }
    }
    // caching_keys - computed: false, optional: true, required: false
    _cachingKeys;
    get cachingKeys() {
        return cdktf.Fn.tolist(this.getListAttribute('caching_keys'));
    }
    set cachingKeys(value) {
        this._cachingKeys = value;
    }
    resetCachingKeys() {
        this._cachingKeys = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get cachingKeysInput() {
        return this._cachingKeys;
    }
    // ttl - computed: false, optional: true, required: false
    _ttl;
    get ttl() {
        return this.getNumberAttribute('ttl');
    }
    set ttl(value) {
        this._ttl = value;
    }
    resetTtl() {
        this._ttl = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get ttlInput() {
        return this._ttl;
    }
}
export function appsyncResolverPipelineConfigToTerraform(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 {
        functions: cdktf.listMapper(cdktf.stringToTerraform)(struct.functions),
    };
}
export class AppsyncResolverPipelineConfigOutputReference 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._functions !== undefined) {
            hasAnyValues = true;
            internalValueResult.functions = this._functions;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._functions = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._functions = value.functions;
        }
    }
    // functions - computed: false, optional: true, required: false
    _functions;
    get functions() {
        return this.getListAttribute('functions');
    }
    set functions(value) {
        this._functions = value;
    }
    resetFunctions() {
        this._functions = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get functionsInput() {
        return this._functions;
    }
}
export function appsyncResolverSyncConfigLambdaConflictHandlerConfigToTerraform(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 AppsyncResolverSyncConfigLambdaConflictHandlerConfigOutputReference 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 appsyncResolverSyncConfigToTerraform(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: appsyncResolverSyncConfigLambdaConflictHandlerConfigToTerraform(struct.lambdaConflictHandlerConfig),
    };
}
export class AppsyncResolverSyncConfigOutputReference 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 AppsyncResolverSyncConfigLambdaConflictHandlerConfigOutputReference(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_resolver aws_appsync_resolver}
*/
export class AppsyncResolver extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_appsync_resolver";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/appsync_resolver aws_appsync_resolver} 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 AppsyncResolverConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_appsync_resolver',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._apiId = config.apiId;
        this._dataSource = config.dataSource;
        this._field = config.field;
        this._kind = config.kind;
        this._maxBatchSize = config.maxBatchSize;
        this._requestTemplate = config.requestTemplate;
        this._responseTemplate = config.responseTemplate;
        this._type = config.type;
        this._cachingConfig.internalValue = config.cachingConfig;
        this._pipelineConfig.internalValue = config.pipelineConfig;
        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: true, required: false
    _dataSource;
    get dataSource() {
        return this.getStringAttribute('data_source');
    }
    set dataSource(value) {
        this._dataSource = value;
    }
    resetDataSource() {
        this._dataSource = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get dataSourceInput() {
        return this._dataSource;
    }
    // field - computed: false, optional: false, required: true
    _field;
    get field() {
        return this.getStringAttribute('field');
    }
    set field(value) {
        this._field = value;
    }
    // Temporarily expose input value. Use with caution.
    get fieldInput() {
        return this._field;
    }
    // id - computed: true, optional: true, required: false
    get id() {
        return this.getStringAttribute('id');
    }
    // kind - computed: false, optional: true, required: false
    _kind;
    get kind() {
        return this.getStringAttribute('kind');
    }
    set kind(value) {
        this._kind = value;
    }
    resetKind() {
        this._kind = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get kindInput() {
        return this._kind;
    }
    // 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;
    }
    // request_template - computed: false, optional: true, required: false
    _requestTemplate;
    get requestTemplate() {
        return this.getStringAttribute('request_template');
    }
    set requestTemplate(value) {
        this._requestTemplate = value;
    }
    resetRequestTemplate() {
        this._requestTemplate = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get requestTemplateInput() {
        return this._requestTemplate;
    }
    // response_template - computed: false, optional: true, required: false
    _responseTemplate;
    get responseTemplate() {
        return this.getStringAttribute('response_template');
    }
    set responseTemplate(value) {
        this._responseTemplate = value;
    }
    resetResponseTemplate() {
        this._responseTemplate = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get responseTemplateInput() {
        return this._responseTemplate;
    }
    // type - computed: false, optional: false, required: true
    _type;
    get type() {
        return this.getStringAttribute('type');
    }
    set type(value) {
        this._type = value;
    }
    // Temporarily expose input value. Use with caution.
    get typeInput() {
        return this._type;
    }
    // caching_config - computed: false, optional: true, required: false
    _cachingConfig = new AppsyncResolverCachingConfigOutputReference(this, "caching_config", true);
    get cachingConfig() {
        return this._cachingConfig;
    }
    putCachingConfig(value) {
        this._cachingConfig.internalValue = value;
    }
    resetCachingConfig() {
        this._cachingConfig.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get cachingConfigInput() {
        return this._cachingConfig.internalValue;
    }
    // pipeline_config - computed: false, optional: true, required: false
    _pipelineConfig = new AppsyncResolverPipelineConfigOutputReference(this, "pipeline_config", true);
    get pipelineConfig() {
        return this._pipelineConfig;
    }
    putPipelineConfig(value) {
        this._pipelineConfig.internalValue = value;
    }
    resetPipelineConfig() {
        this._pipelineConfig.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get pipelineConfigInput() {
        return this._pipelineConfig.internalValue;
    }
    // sync_config - computed: false, optional: true, required: false
    _syncConfig = new AppsyncResolverSyncConfigOutputReference(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),
            field: cdktf.stringToTerraform(this._field),
            kind: cdktf.stringToTerraform(this._kind),
            max_batch_size: cdktf.numberToTerraform(this._maxBatchSize),
            request_template: cdktf.stringToTerraform(this._requestTemplate),
            response_template: cdktf.stringToTerraform(this._responseTemplate),
            type: cdktf.stringToTerraform(this._type),
            caching_config: appsyncResolverCachingConfigToTerraform(this._cachingConfig.internalValue),
            pipeline_config: appsyncResolverPipelineConfigToTerraform(this._pipelineConfig.internalValue),
            sync_config: appsyncResolverSyncConfigToTerraform(this._syncConfig.internalValue),
        };
    }
}
//# sourceMappingURL=appsync-resolver.js.map