// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package provider

import (
	tfTypes "github.com/airbytehq/terraform-provider-airbyte/internal/provider/types"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/models/shared"
	"github.com/hashicorp/terraform-plugin-framework/types"
)

func (r *DestinationQdrantResourceModel) ToSharedDestinationQdrantCreateRequest() *shared.DestinationQdrantCreateRequest {
	var name string
	name = r.Name.ValueString()

	definitionID := new(string)
	if !r.DefinitionID.IsUnknown() && !r.DefinitionID.IsNull() {
		*definitionID = r.DefinitionID.ValueString()
	} else {
		definitionID = nil
	}
	var workspaceID string
	workspaceID = r.WorkspaceID.ValueString()

	var embedding shared.DestinationQdrantEmbedding
	var destinationQdrantOpenAI *shared.DestinationQdrantOpenAI
	if r.Configuration.Embedding.OpenAI != nil {
		var openaiKey string
		openaiKey = r.Configuration.Embedding.OpenAI.OpenaiKey.ValueString()

		destinationQdrantOpenAI = &shared.DestinationQdrantOpenAI{
			OpenaiKey: openaiKey,
		}
	}
	if destinationQdrantOpenAI != nil {
		embedding = shared.DestinationQdrantEmbedding{
			DestinationQdrantOpenAI: destinationQdrantOpenAI,
		}
	}
	var destinationQdrantCohere *shared.DestinationQdrantCohere
	if r.Configuration.Embedding.Cohere != nil {
		var cohereKey string
		cohereKey = r.Configuration.Embedding.Cohere.CohereKey.ValueString()

		destinationQdrantCohere = &shared.DestinationQdrantCohere{
			CohereKey: cohereKey,
		}
	}
	if destinationQdrantCohere != nil {
		embedding = shared.DestinationQdrantEmbedding{
			DestinationQdrantCohere: destinationQdrantCohere,
		}
	}
	var destinationQdrantFake *shared.DestinationQdrantFake
	if r.Configuration.Embedding.Fake != nil {
		destinationQdrantFake = &shared.DestinationQdrantFake{}
	}
	if destinationQdrantFake != nil {
		embedding = shared.DestinationQdrantEmbedding{
			DestinationQdrantFake: destinationQdrantFake,
		}
	}
	var destinationQdrantAzureOpenAI *shared.DestinationQdrantAzureOpenAI
	if r.Configuration.Embedding.AzureOpenAI != nil {
		var apiBase string
		apiBase = r.Configuration.Embedding.AzureOpenAI.APIBase.ValueString()

		var deployment string
		deployment = r.Configuration.Embedding.AzureOpenAI.Deployment.ValueString()

		var openaiKey1 string
		openaiKey1 = r.Configuration.Embedding.AzureOpenAI.OpenaiKey.ValueString()

		destinationQdrantAzureOpenAI = &shared.DestinationQdrantAzureOpenAI{
			APIBase:    apiBase,
			Deployment: deployment,
			OpenaiKey:  openaiKey1,
		}
	}
	if destinationQdrantAzureOpenAI != nil {
		embedding = shared.DestinationQdrantEmbedding{
			DestinationQdrantAzureOpenAI: destinationQdrantAzureOpenAI,
		}
	}
	var destinationQdrantOpenAICompatible *shared.DestinationQdrantOpenAICompatible
	if r.Configuration.Embedding.OpenAICompatible != nil {
		apiKey := new(string)
		if !r.Configuration.Embedding.OpenAICompatible.APIKey.IsUnknown() && !r.Configuration.Embedding.OpenAICompatible.APIKey.IsNull() {
			*apiKey = r.Configuration.Embedding.OpenAICompatible.APIKey.ValueString()
		} else {
			apiKey = nil
		}
		var baseURL string
		baseURL = r.Configuration.Embedding.OpenAICompatible.BaseURL.ValueString()

		var dimensions int64
		dimensions = r.Configuration.Embedding.OpenAICompatible.Dimensions.ValueInt64()

		modelName := new(string)
		if !r.Configuration.Embedding.OpenAICompatible.ModelName.IsUnknown() && !r.Configuration.Embedding.OpenAICompatible.ModelName.IsNull() {
			*modelName = r.Configuration.Embedding.OpenAICompatible.ModelName.ValueString()
		} else {
			modelName = nil
		}
		destinationQdrantOpenAICompatible = &shared.DestinationQdrantOpenAICompatible{
			APIKey:     apiKey,
			BaseURL:    baseURL,
			Dimensions: dimensions,
			ModelName:  modelName,
		}
	}
	if destinationQdrantOpenAICompatible != nil {
		embedding = shared.DestinationQdrantEmbedding{
			DestinationQdrantOpenAICompatible: destinationQdrantOpenAICompatible,
		}
	}
	var authMethod *shared.DestinationQdrantAuthenticationMethod
	if r.Configuration.Indexing.AuthMethod != nil {
		var apiKeyAuth *shared.APIKeyAuth
		if r.Configuration.Indexing.AuthMethod.APIKeyAuth != nil {
			var apiKey1 string
			apiKey1 = r.Configuration.Indexing.AuthMethod.APIKeyAuth.APIKey.ValueString()

			apiKeyAuth = &shared.APIKeyAuth{
				APIKey: apiKey1,
			}
		}
		if apiKeyAuth != nil {
			authMethod = &shared.DestinationQdrantAuthenticationMethod{
				APIKeyAuth: apiKeyAuth,
			}
		}
		var destinationQdrantNoAuth *shared.DestinationQdrantNoAuth
		if r.Configuration.Indexing.AuthMethod.NoAuth != nil {
			destinationQdrantNoAuth = &shared.DestinationQdrantNoAuth{}
		}
		if destinationQdrantNoAuth != nil {
			authMethod = &shared.DestinationQdrantAuthenticationMethod{
				DestinationQdrantNoAuth: destinationQdrantNoAuth,
			}
		}
	}
	var collection string
	collection = r.Configuration.Indexing.Collection.ValueString()

	distanceMetric := new(shared.DistanceMetric)
	if !r.Configuration.Indexing.DistanceMetric.IsUnknown() && !r.Configuration.Indexing.DistanceMetric.IsNull() {
		*distanceMetric = shared.DistanceMetric(r.Configuration.Indexing.DistanceMetric.ValueString())
	} else {
		distanceMetric = nil
	}
	preferGrpc := new(bool)
	if !r.Configuration.Indexing.PreferGrpc.IsUnknown() && !r.Configuration.Indexing.PreferGrpc.IsNull() {
		*preferGrpc = r.Configuration.Indexing.PreferGrpc.ValueBool()
	} else {
		preferGrpc = nil
	}
	textField := new(string)
	if !r.Configuration.Indexing.TextField.IsUnknown() && !r.Configuration.Indexing.TextField.IsNull() {
		*textField = r.Configuration.Indexing.TextField.ValueString()
	} else {
		textField = nil
	}
	var url string
	url = r.Configuration.Indexing.URL.ValueString()

	indexing := shared.DestinationQdrantIndexing{
		AuthMethod:     authMethod,
		Collection:     collection,
		DistanceMetric: distanceMetric,
		PreferGrpc:     preferGrpc,
		TextField:      textField,
		URL:            url,
	}
	omitRawText := new(bool)
	if !r.Configuration.OmitRawText.IsUnknown() && !r.Configuration.OmitRawText.IsNull() {
		*omitRawText = r.Configuration.OmitRawText.ValueBool()
	} else {
		omitRawText = nil
	}
	chunkOverlap := new(int64)
	if !r.Configuration.Processing.ChunkOverlap.IsUnknown() && !r.Configuration.Processing.ChunkOverlap.IsNull() {
		*chunkOverlap = r.Configuration.Processing.ChunkOverlap.ValueInt64()
	} else {
		chunkOverlap = nil
	}
	var chunkSize int64
	chunkSize = r.Configuration.Processing.ChunkSize.ValueInt64()

	var fieldNameMappings []shared.DestinationQdrantFieldNameMappingConfigModel = []shared.DestinationQdrantFieldNameMappingConfigModel{}
	for _, fieldNameMappingsItem := range r.Configuration.Processing.FieldNameMappings {
		var fromField string
		fromField = fieldNameMappingsItem.FromField.ValueString()

		var toField string
		toField = fieldNameMappingsItem.ToField.ValueString()

		fieldNameMappings = append(fieldNameMappings, shared.DestinationQdrantFieldNameMappingConfigModel{
			FromField: fromField,
			ToField:   toField,
		})
	}
	var metadataFields []string = []string{}
	for _, metadataFieldsItem := range r.Configuration.Processing.MetadataFields {
		metadataFields = append(metadataFields, metadataFieldsItem.ValueString())
	}
	var textFields []string = []string{}
	for _, textFieldsItem := range r.Configuration.Processing.TextFields {
		textFields = append(textFields, textFieldsItem.ValueString())
	}
	var textSplitter *shared.DestinationQdrantTextSplitter
	if r.Configuration.Processing.TextSplitter != nil {
		var destinationQdrantBySeparator *shared.DestinationQdrantBySeparator
		if r.Configuration.Processing.TextSplitter.BySeparator != nil {
			keepSeparator := new(bool)
			if !r.Configuration.Processing.TextSplitter.BySeparator.KeepSeparator.IsUnknown() && !r.Configuration.Processing.TextSplitter.BySeparator.KeepSeparator.IsNull() {
				*keepSeparator = r.Configuration.Processing.TextSplitter.BySeparator.KeepSeparator.ValueBool()
			} else {
				keepSeparator = nil
			}
			var separators []string = []string{}
			for _, separatorsItem := range r.Configuration.Processing.TextSplitter.BySeparator.Separators {
				separators = append(separators, separatorsItem.ValueString())
			}
			destinationQdrantBySeparator = &shared.DestinationQdrantBySeparator{
				KeepSeparator: keepSeparator,
				Separators:    separators,
			}
		}
		if destinationQdrantBySeparator != nil {
			textSplitter = &shared.DestinationQdrantTextSplitter{
				DestinationQdrantBySeparator: destinationQdrantBySeparator,
			}
		}
		var destinationQdrantByMarkdownHeader *shared.DestinationQdrantByMarkdownHeader
		if r.Configuration.Processing.TextSplitter.ByMarkdownHeader != nil {
			splitLevel := new(int64)
			if !r.Configuration.Processing.TextSplitter.ByMarkdownHeader.SplitLevel.IsUnknown() && !r.Configuration.Processing.TextSplitter.ByMarkdownHeader.SplitLevel.IsNull() {
				*splitLevel = r.Configuration.Processing.TextSplitter.ByMarkdownHeader.SplitLevel.ValueInt64()
			} else {
				splitLevel = nil
			}
			destinationQdrantByMarkdownHeader = &shared.DestinationQdrantByMarkdownHeader{
				SplitLevel: splitLevel,
			}
		}
		if destinationQdrantByMarkdownHeader != nil {
			textSplitter = &shared.DestinationQdrantTextSplitter{
				DestinationQdrantByMarkdownHeader: destinationQdrantByMarkdownHeader,
			}
		}
		var destinationQdrantByProgrammingLanguage *shared.DestinationQdrantByProgrammingLanguage
		if r.Configuration.Processing.TextSplitter.ByProgrammingLanguage != nil {
			language := shared.DestinationQdrantLanguage(r.Configuration.Processing.TextSplitter.ByProgrammingLanguage.Language.ValueString())
			destinationQdrantByProgrammingLanguage = &shared.DestinationQdrantByProgrammingLanguage{
				Language: language,
			}
		}
		if destinationQdrantByProgrammingLanguage != nil {
			textSplitter = &shared.DestinationQdrantTextSplitter{
				DestinationQdrantByProgrammingLanguage: destinationQdrantByProgrammingLanguage,
			}
		}
	}
	processing := shared.DestinationQdrantProcessingConfigModel{
		ChunkOverlap:      chunkOverlap,
		ChunkSize:         chunkSize,
		FieldNameMappings: fieldNameMappings,
		MetadataFields:    metadataFields,
		TextFields:        textFields,
		TextSplitter:      textSplitter,
	}
	configuration := shared.DestinationQdrant{
		Embedding:   embedding,
		Indexing:    indexing,
		OmitRawText: omitRawText,
		Processing:  processing,
	}
	out := shared.DestinationQdrantCreateRequest{
		Name:          name,
		DefinitionID:  definitionID,
		WorkspaceID:   workspaceID,
		Configuration: configuration,
	}
	return &out
}

func (r *DestinationQdrantResourceModel) RefreshFromSharedDestinationResponse(resp *shared.DestinationResponse) {
	if resp != nil {
		r.CreatedAt = types.Int64Value(resp.CreatedAt)
		r.DefinitionID = types.StringValue(resp.DefinitionID)
		r.DestinationID = types.StringValue(resp.DestinationID)
		r.DestinationType = types.StringValue(resp.DestinationType)
		r.Name = types.StringValue(resp.Name)
		if resp.ResourceAllocation == nil {
			r.ResourceAllocation = nil
		} else {
			r.ResourceAllocation = &tfTypes.ScopedResourceRequirements{}
			if resp.ResourceAllocation.Default == nil {
				r.ResourceAllocation.Default = nil
			} else {
				r.ResourceAllocation.Default = &tfTypes.ResourceRequirements{}
				r.ResourceAllocation.Default.CPULimit = types.StringPointerValue(resp.ResourceAllocation.Default.CPULimit)
				r.ResourceAllocation.Default.CPURequest = types.StringPointerValue(resp.ResourceAllocation.Default.CPURequest)
				r.ResourceAllocation.Default.EphemeralStorageLimit = types.StringPointerValue(resp.ResourceAllocation.Default.EphemeralStorageLimit)
				r.ResourceAllocation.Default.EphemeralStorageRequest = types.StringPointerValue(resp.ResourceAllocation.Default.EphemeralStorageRequest)
				r.ResourceAllocation.Default.MemoryLimit = types.StringPointerValue(resp.ResourceAllocation.Default.MemoryLimit)
				r.ResourceAllocation.Default.MemoryRequest = types.StringPointerValue(resp.ResourceAllocation.Default.MemoryRequest)
			}
			r.ResourceAllocation.JobSpecific = []tfTypes.JobTypeResourceLimit{}
			if len(r.ResourceAllocation.JobSpecific) > len(resp.ResourceAllocation.JobSpecific) {
				r.ResourceAllocation.JobSpecific = r.ResourceAllocation.JobSpecific[:len(resp.ResourceAllocation.JobSpecific)]
			}
			for jobSpecificCount, jobSpecificItem := range resp.ResourceAllocation.JobSpecific {
				var jobSpecific1 tfTypes.JobTypeResourceLimit
				jobSpecific1.JobType = types.StringValue(string(jobSpecificItem.JobType))
				jobSpecific1.ResourceRequirements.CPULimit = types.StringPointerValue(jobSpecificItem.ResourceRequirements.CPULimit)
				jobSpecific1.ResourceRequirements.CPURequest = types.StringPointerValue(jobSpecificItem.ResourceRequirements.CPURequest)
				jobSpecific1.ResourceRequirements.EphemeralStorageLimit = types.StringPointerValue(jobSpecificItem.ResourceRequirements.EphemeralStorageLimit)
				jobSpecific1.ResourceRequirements.EphemeralStorageRequest = types.StringPointerValue(jobSpecificItem.ResourceRequirements.EphemeralStorageRequest)
				jobSpecific1.ResourceRequirements.MemoryLimit = types.StringPointerValue(jobSpecificItem.ResourceRequirements.MemoryLimit)
				jobSpecific1.ResourceRequirements.MemoryRequest = types.StringPointerValue(jobSpecificItem.ResourceRequirements.MemoryRequest)
				if jobSpecificCount+1 > len(r.ResourceAllocation.JobSpecific) {
					r.ResourceAllocation.JobSpecific = append(r.ResourceAllocation.JobSpecific, jobSpecific1)
				} else {
					r.ResourceAllocation.JobSpecific[jobSpecificCount].JobType = jobSpecific1.JobType
					r.ResourceAllocation.JobSpecific[jobSpecificCount].ResourceRequirements = jobSpecific1.ResourceRequirements
				}
			}
		}
		r.WorkspaceID = types.StringValue(resp.WorkspaceID)
	}
}

func (r *DestinationQdrantResourceModel) ToSharedDestinationQdrantPutRequest() *shared.DestinationQdrantPutRequest {
	var name string
	name = r.Name.ValueString()

	var workspaceID string
	workspaceID = r.WorkspaceID.ValueString()

	var embedding shared.DestinationQdrantUpdateEmbedding
	var destinationQdrantUpdateOpenAI *shared.DestinationQdrantUpdateOpenAI
	if r.Configuration.Embedding.OpenAI != nil {
		var openaiKey string
		openaiKey = r.Configuration.Embedding.OpenAI.OpenaiKey.ValueString()

		destinationQdrantUpdateOpenAI = &shared.DestinationQdrantUpdateOpenAI{
			OpenaiKey: openaiKey,
		}
	}
	if destinationQdrantUpdateOpenAI != nil {
		embedding = shared.DestinationQdrantUpdateEmbedding{
			DestinationQdrantUpdateOpenAI: destinationQdrantUpdateOpenAI,
		}
	}
	var destinationQdrantUpdateCohere *shared.DestinationQdrantUpdateCohere
	if r.Configuration.Embedding.Cohere != nil {
		var cohereKey string
		cohereKey = r.Configuration.Embedding.Cohere.CohereKey.ValueString()

		destinationQdrantUpdateCohere = &shared.DestinationQdrantUpdateCohere{
			CohereKey: cohereKey,
		}
	}
	if destinationQdrantUpdateCohere != nil {
		embedding = shared.DestinationQdrantUpdateEmbedding{
			DestinationQdrantUpdateCohere: destinationQdrantUpdateCohere,
		}
	}
	var destinationQdrantUpdateFake *shared.DestinationQdrantUpdateFake
	if r.Configuration.Embedding.Fake != nil {
		destinationQdrantUpdateFake = &shared.DestinationQdrantUpdateFake{}
	}
	if destinationQdrantUpdateFake != nil {
		embedding = shared.DestinationQdrantUpdateEmbedding{
			DestinationQdrantUpdateFake: destinationQdrantUpdateFake,
		}
	}
	var destinationQdrantUpdateAzureOpenAI *shared.DestinationQdrantUpdateAzureOpenAI
	if r.Configuration.Embedding.AzureOpenAI != nil {
		var apiBase string
		apiBase = r.Configuration.Embedding.AzureOpenAI.APIBase.ValueString()

		var deployment string
		deployment = r.Configuration.Embedding.AzureOpenAI.Deployment.ValueString()

		var openaiKey1 string
		openaiKey1 = r.Configuration.Embedding.AzureOpenAI.OpenaiKey.ValueString()

		destinationQdrantUpdateAzureOpenAI = &shared.DestinationQdrantUpdateAzureOpenAI{
			APIBase:    apiBase,
			Deployment: deployment,
			OpenaiKey:  openaiKey1,
		}
	}
	if destinationQdrantUpdateAzureOpenAI != nil {
		embedding = shared.DestinationQdrantUpdateEmbedding{
			DestinationQdrantUpdateAzureOpenAI: destinationQdrantUpdateAzureOpenAI,
		}
	}
	var destinationQdrantUpdateOpenAICompatible *shared.DestinationQdrantUpdateOpenAICompatible
	if r.Configuration.Embedding.OpenAICompatible != nil {
		apiKey := new(string)
		if !r.Configuration.Embedding.OpenAICompatible.APIKey.IsUnknown() && !r.Configuration.Embedding.OpenAICompatible.APIKey.IsNull() {
			*apiKey = r.Configuration.Embedding.OpenAICompatible.APIKey.ValueString()
		} else {
			apiKey = nil
		}
		var baseURL string
		baseURL = r.Configuration.Embedding.OpenAICompatible.BaseURL.ValueString()

		var dimensions int64
		dimensions = r.Configuration.Embedding.OpenAICompatible.Dimensions.ValueInt64()

		modelName := new(string)
		if !r.Configuration.Embedding.OpenAICompatible.ModelName.IsUnknown() && !r.Configuration.Embedding.OpenAICompatible.ModelName.IsNull() {
			*modelName = r.Configuration.Embedding.OpenAICompatible.ModelName.ValueString()
		} else {
			modelName = nil
		}
		destinationQdrantUpdateOpenAICompatible = &shared.DestinationQdrantUpdateOpenAICompatible{
			APIKey:     apiKey,
			BaseURL:    baseURL,
			Dimensions: dimensions,
			ModelName:  modelName,
		}
	}
	if destinationQdrantUpdateOpenAICompatible != nil {
		embedding = shared.DestinationQdrantUpdateEmbedding{
			DestinationQdrantUpdateOpenAICompatible: destinationQdrantUpdateOpenAICompatible,
		}
	}
	var authMethod *shared.DestinationQdrantUpdateAuthenticationMethod
	if r.Configuration.Indexing.AuthMethod != nil {
		var destinationQdrantUpdateAPIKeyAuth *shared.DestinationQdrantUpdateAPIKeyAuth
		if r.Configuration.Indexing.AuthMethod.APIKeyAuth != nil {
			var apiKey1 string
			apiKey1 = r.Configuration.Indexing.AuthMethod.APIKeyAuth.APIKey.ValueString()

			destinationQdrantUpdateAPIKeyAuth = &shared.DestinationQdrantUpdateAPIKeyAuth{
				APIKey: apiKey1,
			}
		}
		if destinationQdrantUpdateAPIKeyAuth != nil {
			authMethod = &shared.DestinationQdrantUpdateAuthenticationMethod{
				DestinationQdrantUpdateAPIKeyAuth: destinationQdrantUpdateAPIKeyAuth,
			}
		}
		var destinationQdrantUpdateNoAuth *shared.DestinationQdrantUpdateNoAuth
		if r.Configuration.Indexing.AuthMethod.NoAuth != nil {
			destinationQdrantUpdateNoAuth = &shared.DestinationQdrantUpdateNoAuth{}
		}
		if destinationQdrantUpdateNoAuth != nil {
			authMethod = &shared.DestinationQdrantUpdateAuthenticationMethod{
				DestinationQdrantUpdateNoAuth: destinationQdrantUpdateNoAuth,
			}
		}
	}
	var collection string
	collection = r.Configuration.Indexing.Collection.ValueString()

	distanceMetric := new(shared.DestinationQdrantUpdateDistanceMetric)
	if !r.Configuration.Indexing.DistanceMetric.IsUnknown() && !r.Configuration.Indexing.DistanceMetric.IsNull() {
		*distanceMetric = shared.DestinationQdrantUpdateDistanceMetric(r.Configuration.Indexing.DistanceMetric.ValueString())
	} else {
		distanceMetric = nil
	}
	preferGrpc := new(bool)
	if !r.Configuration.Indexing.PreferGrpc.IsUnknown() && !r.Configuration.Indexing.PreferGrpc.IsNull() {
		*preferGrpc = r.Configuration.Indexing.PreferGrpc.ValueBool()
	} else {
		preferGrpc = nil
	}
	textField := new(string)
	if !r.Configuration.Indexing.TextField.IsUnknown() && !r.Configuration.Indexing.TextField.IsNull() {
		*textField = r.Configuration.Indexing.TextField.ValueString()
	} else {
		textField = nil
	}
	var url string
	url = r.Configuration.Indexing.URL.ValueString()

	indexing := shared.DestinationQdrantUpdateIndexing{
		AuthMethod:     authMethod,
		Collection:     collection,
		DistanceMetric: distanceMetric,
		PreferGrpc:     preferGrpc,
		TextField:      textField,
		URL:            url,
	}
	omitRawText := new(bool)
	if !r.Configuration.OmitRawText.IsUnknown() && !r.Configuration.OmitRawText.IsNull() {
		*omitRawText = r.Configuration.OmitRawText.ValueBool()
	} else {
		omitRawText = nil
	}
	chunkOverlap := new(int64)
	if !r.Configuration.Processing.ChunkOverlap.IsUnknown() && !r.Configuration.Processing.ChunkOverlap.IsNull() {
		*chunkOverlap = r.Configuration.Processing.ChunkOverlap.ValueInt64()
	} else {
		chunkOverlap = nil
	}
	var chunkSize int64
	chunkSize = r.Configuration.Processing.ChunkSize.ValueInt64()

	var fieldNameMappings []shared.DestinationQdrantUpdateFieldNameMappingConfigModel = []shared.DestinationQdrantUpdateFieldNameMappingConfigModel{}
	for _, fieldNameMappingsItem := range r.Configuration.Processing.FieldNameMappings {
		var fromField string
		fromField = fieldNameMappingsItem.FromField.ValueString()

		var toField string
		toField = fieldNameMappingsItem.ToField.ValueString()

		fieldNameMappings = append(fieldNameMappings, shared.DestinationQdrantUpdateFieldNameMappingConfigModel{
			FromField: fromField,
			ToField:   toField,
		})
	}
	var metadataFields []string = []string{}
	for _, metadataFieldsItem := range r.Configuration.Processing.MetadataFields {
		metadataFields = append(metadataFields, metadataFieldsItem.ValueString())
	}
	var textFields []string = []string{}
	for _, textFieldsItem := range r.Configuration.Processing.TextFields {
		textFields = append(textFields, textFieldsItem.ValueString())
	}
	var textSplitter *shared.DestinationQdrantUpdateTextSplitter
	if r.Configuration.Processing.TextSplitter != nil {
		var destinationQdrantUpdateBySeparator *shared.DestinationQdrantUpdateBySeparator
		if r.Configuration.Processing.TextSplitter.BySeparator != nil {
			keepSeparator := new(bool)
			if !r.Configuration.Processing.TextSplitter.BySeparator.KeepSeparator.IsUnknown() && !r.Configuration.Processing.TextSplitter.BySeparator.KeepSeparator.IsNull() {
				*keepSeparator = r.Configuration.Processing.TextSplitter.BySeparator.KeepSeparator.ValueBool()
			} else {
				keepSeparator = nil
			}
			var separators []string = []string{}
			for _, separatorsItem := range r.Configuration.Processing.TextSplitter.BySeparator.Separators {
				separators = append(separators, separatorsItem.ValueString())
			}
			destinationQdrantUpdateBySeparator = &shared.DestinationQdrantUpdateBySeparator{
				KeepSeparator: keepSeparator,
				Separators:    separators,
			}
		}
		if destinationQdrantUpdateBySeparator != nil {
			textSplitter = &shared.DestinationQdrantUpdateTextSplitter{
				DestinationQdrantUpdateBySeparator: destinationQdrantUpdateBySeparator,
			}
		}
		var destinationQdrantUpdateByMarkdownHeader *shared.DestinationQdrantUpdateByMarkdownHeader
		if r.Configuration.Processing.TextSplitter.ByMarkdownHeader != nil {
			splitLevel := new(int64)
			if !r.Configuration.Processing.TextSplitter.ByMarkdownHeader.SplitLevel.IsUnknown() && !r.Configuration.Processing.TextSplitter.ByMarkdownHeader.SplitLevel.IsNull() {
				*splitLevel = r.Configuration.Processing.TextSplitter.ByMarkdownHeader.SplitLevel.ValueInt64()
			} else {
				splitLevel = nil
			}
			destinationQdrantUpdateByMarkdownHeader = &shared.DestinationQdrantUpdateByMarkdownHeader{
				SplitLevel: splitLevel,
			}
		}
		if destinationQdrantUpdateByMarkdownHeader != nil {
			textSplitter = &shared.DestinationQdrantUpdateTextSplitter{
				DestinationQdrantUpdateByMarkdownHeader: destinationQdrantUpdateByMarkdownHeader,
			}
		}
		var destinationQdrantUpdateByProgrammingLanguage *shared.DestinationQdrantUpdateByProgrammingLanguage
		if r.Configuration.Processing.TextSplitter.ByProgrammingLanguage != nil {
			language := shared.DestinationQdrantUpdateLanguage(r.Configuration.Processing.TextSplitter.ByProgrammingLanguage.Language.ValueString())
			destinationQdrantUpdateByProgrammingLanguage = &shared.DestinationQdrantUpdateByProgrammingLanguage{
				Language: language,
			}
		}
		if destinationQdrantUpdateByProgrammingLanguage != nil {
			textSplitter = &shared.DestinationQdrantUpdateTextSplitter{
				DestinationQdrantUpdateByProgrammingLanguage: destinationQdrantUpdateByProgrammingLanguage,
			}
		}
	}
	processing := shared.DestinationQdrantUpdateProcessingConfigModel{
		ChunkOverlap:      chunkOverlap,
		ChunkSize:         chunkSize,
		FieldNameMappings: fieldNameMappings,
		MetadataFields:    metadataFields,
		TextFields:        textFields,
		TextSplitter:      textSplitter,
	}
	configuration := shared.DestinationQdrantUpdate{
		Embedding:   embedding,
		Indexing:    indexing,
		OmitRawText: omitRawText,
		Processing:  processing,
	}
	out := shared.DestinationQdrantPutRequest{
		Name:          name,
		WorkspaceID:   workspaceID,
		Configuration: configuration,
	}
	return &out
}
