// 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"
	"time"
)

func (r *SourceSharepointEnterpriseResourceModel) ToSharedSourceSharepointEnterpriseCreateRequest() *shared.SourceSharepointEnterpriseCreateRequest {
	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 credentials shared.SourceSharepointEnterpriseAuthentication
	var sourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth *shared.SourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth
	if r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth != nil {
		var clientID string
		clientID = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.ClientID.ValueString()

		var clientSecret string
		clientSecret = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.ClientSecret.ValueString()

		refreshToken := new(string)
		if !r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.RefreshToken.IsUnknown() && !r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.RefreshToken.IsNull() {
			*refreshToken = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.RefreshToken.ValueString()
		} else {
			refreshToken = nil
		}
		var tenantID string
		tenantID = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.TenantID.ValueString()

		sourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth = &shared.SourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth{
			ClientID:     clientID,
			ClientSecret: clientSecret,
			RefreshToken: refreshToken,
			TenantID:     tenantID,
		}
	}
	if sourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth != nil {
		credentials = shared.SourceSharepointEnterpriseAuthentication{
			SourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth: sourceSharepointEnterpriseAuthenticateViaMicrosoftOAuth,
		}
	}
	var sourceSharepointEnterpriseServiceKeyAuthentication *shared.SourceSharepointEnterpriseServiceKeyAuthentication
	if r.Configuration.Credentials.ServiceKeyAuthentication != nil {
		var clientId1 string
		clientId1 = r.Configuration.Credentials.ServiceKeyAuthentication.ClientID.ValueString()

		var clientSecret1 string
		clientSecret1 = r.Configuration.Credentials.ServiceKeyAuthentication.ClientSecret.ValueString()

		var tenantId1 string
		tenantId1 = r.Configuration.Credentials.ServiceKeyAuthentication.TenantID.ValueString()

		var userPrincipalName string
		userPrincipalName = r.Configuration.Credentials.ServiceKeyAuthentication.UserPrincipalName.ValueString()

		sourceSharepointEnterpriseServiceKeyAuthentication = &shared.SourceSharepointEnterpriseServiceKeyAuthentication{
			ClientID:          clientId1,
			ClientSecret:      clientSecret1,
			TenantID:          tenantId1,
			UserPrincipalName: userPrincipalName,
		}
	}
	if sourceSharepointEnterpriseServiceKeyAuthentication != nil {
		credentials = shared.SourceSharepointEnterpriseAuthentication{
			SourceSharepointEnterpriseServiceKeyAuthentication: sourceSharepointEnterpriseServiceKeyAuthentication,
		}
	}
	var deliveryMethod *shared.SourceSharepointEnterpriseDeliveryMethod
	if r.Configuration.DeliveryMethod != nil {
		var sourceSharepointEnterpriseReplicateRecords *shared.SourceSharepointEnterpriseReplicateRecords
		if r.Configuration.DeliveryMethod.ReplicateRecords != nil {
			sourceSharepointEnterpriseReplicateRecords = &shared.SourceSharepointEnterpriseReplicateRecords{}
		}
		if sourceSharepointEnterpriseReplicateRecords != nil {
			deliveryMethod = &shared.SourceSharepointEnterpriseDeliveryMethod{
				SourceSharepointEnterpriseReplicateRecords: sourceSharepointEnterpriseReplicateRecords,
			}
		}
		var sourceSharepointEnterpriseCopyRawFiles *shared.SourceSharepointEnterpriseCopyRawFiles
		if r.Configuration.DeliveryMethod.CopyRawFiles != nil {
			preserveDirectoryStructure := new(bool)
			if !r.Configuration.DeliveryMethod.CopyRawFiles.PreserveDirectoryStructure.IsUnknown() && !r.Configuration.DeliveryMethod.CopyRawFiles.PreserveDirectoryStructure.IsNull() {
				*preserveDirectoryStructure = r.Configuration.DeliveryMethod.CopyRawFiles.PreserveDirectoryStructure.ValueBool()
			} else {
				preserveDirectoryStructure = nil
			}
			sourceSharepointEnterpriseCopyRawFiles = &shared.SourceSharepointEnterpriseCopyRawFiles{
				PreserveDirectoryStructure: preserveDirectoryStructure,
			}
		}
		if sourceSharepointEnterpriseCopyRawFiles != nil {
			deliveryMethod = &shared.SourceSharepointEnterpriseDeliveryMethod{
				SourceSharepointEnterpriseCopyRawFiles: sourceSharepointEnterpriseCopyRawFiles,
			}
		}
		var sourceSharepointEnterpriseReplicatePermissionsACL *shared.SourceSharepointEnterpriseReplicatePermissionsACL
		if r.Configuration.DeliveryMethod.ReplicatePermissionsACL != nil {
			includeIdentitiesStream := new(bool)
			if !r.Configuration.DeliveryMethod.ReplicatePermissionsACL.IncludeIdentitiesStream.IsUnknown() && !r.Configuration.DeliveryMethod.ReplicatePermissionsACL.IncludeIdentitiesStream.IsNull() {
				*includeIdentitiesStream = r.Configuration.DeliveryMethod.ReplicatePermissionsACL.IncludeIdentitiesStream.ValueBool()
			} else {
				includeIdentitiesStream = nil
			}
			sourceSharepointEnterpriseReplicatePermissionsACL = &shared.SourceSharepointEnterpriseReplicatePermissionsACL{
				IncludeIdentitiesStream: includeIdentitiesStream,
			}
		}
		if sourceSharepointEnterpriseReplicatePermissionsACL != nil {
			deliveryMethod = &shared.SourceSharepointEnterpriseDeliveryMethod{
				SourceSharepointEnterpriseReplicatePermissionsACL: sourceSharepointEnterpriseReplicatePermissionsACL,
			}
		}
	}
	folderPath := new(string)
	if !r.Configuration.FolderPath.IsUnknown() && !r.Configuration.FolderPath.IsNull() {
		*folderPath = r.Configuration.FolderPath.ValueString()
	} else {
		folderPath = nil
	}
	searchScope := new(shared.SourceSharepointEnterpriseSearchScope)
	if !r.Configuration.SearchScope.IsUnknown() && !r.Configuration.SearchScope.IsNull() {
		*searchScope = shared.SourceSharepointEnterpriseSearchScope(r.Configuration.SearchScope.ValueString())
	} else {
		searchScope = nil
	}
	siteURL := new(string)
	if !r.Configuration.SiteURL.IsUnknown() && !r.Configuration.SiteURL.IsNull() {
		*siteURL = r.Configuration.SiteURL.ValueString()
	} else {
		siteURL = nil
	}
	startDate := new(time.Time)
	if !r.Configuration.StartDate.IsUnknown() && !r.Configuration.StartDate.IsNull() {
		*startDate, _ = time.Parse(time.RFC3339Nano, r.Configuration.StartDate.ValueString())
	} else {
		startDate = nil
	}
	var streams []shared.SourceSharepointEnterpriseFileBasedStreamConfig = []shared.SourceSharepointEnterpriseFileBasedStreamConfig{}
	for _, streamsItem := range r.Configuration.Streams {
		daysToSyncIfHistoryIsFull := new(int64)
		if !streamsItem.DaysToSyncIfHistoryIsFull.IsUnknown() && !streamsItem.DaysToSyncIfHistoryIsFull.IsNull() {
			*daysToSyncIfHistoryIsFull = streamsItem.DaysToSyncIfHistoryIsFull.ValueInt64()
		} else {
			daysToSyncIfHistoryIsFull = nil
		}
		var format shared.SourceSharepointEnterpriseFormat
		var sourceSharepointEnterpriseAvroFormat *shared.SourceSharepointEnterpriseAvroFormat
		if streamsItem.Format.AvroFormat != nil {
			doubleAsString := new(bool)
			if !streamsItem.Format.AvroFormat.DoubleAsString.IsUnknown() && !streamsItem.Format.AvroFormat.DoubleAsString.IsNull() {
				*doubleAsString = streamsItem.Format.AvroFormat.DoubleAsString.ValueBool()
			} else {
				doubleAsString = nil
			}
			sourceSharepointEnterpriseAvroFormat = &shared.SourceSharepointEnterpriseAvroFormat{
				DoubleAsString: doubleAsString,
			}
		}
		if sourceSharepointEnterpriseAvroFormat != nil {
			format = shared.SourceSharepointEnterpriseFormat{
				SourceSharepointEnterpriseAvroFormat: sourceSharepointEnterpriseAvroFormat,
			}
		}
		var sourceSharepointEnterpriseCSVFormat *shared.SourceSharepointEnterpriseCSVFormat
		if streamsItem.Format.CSVFormat != nil {
			delimiter := new(string)
			if !streamsItem.Format.CSVFormat.Delimiter.IsUnknown() && !streamsItem.Format.CSVFormat.Delimiter.IsNull() {
				*delimiter = streamsItem.Format.CSVFormat.Delimiter.ValueString()
			} else {
				delimiter = nil
			}
			doubleQuote := new(bool)
			if !streamsItem.Format.CSVFormat.DoubleQuote.IsUnknown() && !streamsItem.Format.CSVFormat.DoubleQuote.IsNull() {
				*doubleQuote = streamsItem.Format.CSVFormat.DoubleQuote.ValueBool()
			} else {
				doubleQuote = nil
			}
			encoding := new(string)
			if !streamsItem.Format.CSVFormat.Encoding.IsUnknown() && !streamsItem.Format.CSVFormat.Encoding.IsNull() {
				*encoding = streamsItem.Format.CSVFormat.Encoding.ValueString()
			} else {
				encoding = nil
			}
			escapeChar := new(string)
			if !streamsItem.Format.CSVFormat.EscapeChar.IsUnknown() && !streamsItem.Format.CSVFormat.EscapeChar.IsNull() {
				*escapeChar = streamsItem.Format.CSVFormat.EscapeChar.ValueString()
			} else {
				escapeChar = nil
			}
			var falseValues []string = []string{}
			for _, falseValuesItem := range streamsItem.Format.CSVFormat.FalseValues {
				falseValues = append(falseValues, falseValuesItem.ValueString())
			}
			var headerDefinition *shared.SourceSharepointEnterpriseCSVHeaderDefinition
			if streamsItem.Format.CSVFormat.HeaderDefinition != nil {
				var sourceSharepointEnterpriseFromCSV *shared.SourceSharepointEnterpriseFromCSV
				if streamsItem.Format.CSVFormat.HeaderDefinition.FromCSV != nil {
					sourceSharepointEnterpriseFromCSV = &shared.SourceSharepointEnterpriseFromCSV{}
				}
				if sourceSharepointEnterpriseFromCSV != nil {
					headerDefinition = &shared.SourceSharepointEnterpriseCSVHeaderDefinition{
						SourceSharepointEnterpriseFromCSV: sourceSharepointEnterpriseFromCSV,
					}
				}
				var sourceSharepointEnterpriseAutogenerated *shared.SourceSharepointEnterpriseAutogenerated
				if streamsItem.Format.CSVFormat.HeaderDefinition.Autogenerated != nil {
					sourceSharepointEnterpriseAutogenerated = &shared.SourceSharepointEnterpriseAutogenerated{}
				}
				if sourceSharepointEnterpriseAutogenerated != nil {
					headerDefinition = &shared.SourceSharepointEnterpriseCSVHeaderDefinition{
						SourceSharepointEnterpriseAutogenerated: sourceSharepointEnterpriseAutogenerated,
					}
				}
				var sourceSharepointEnterpriseUserProvided *shared.SourceSharepointEnterpriseUserProvided
				if streamsItem.Format.CSVFormat.HeaderDefinition.UserProvided != nil {
					var columnNames []string = []string{}
					for _, columnNamesItem := range streamsItem.Format.CSVFormat.HeaderDefinition.UserProvided.ColumnNames {
						columnNames = append(columnNames, columnNamesItem.ValueString())
					}
					sourceSharepointEnterpriseUserProvided = &shared.SourceSharepointEnterpriseUserProvided{
						ColumnNames: columnNames,
					}
				}
				if sourceSharepointEnterpriseUserProvided != nil {
					headerDefinition = &shared.SourceSharepointEnterpriseCSVHeaderDefinition{
						SourceSharepointEnterpriseUserProvided: sourceSharepointEnterpriseUserProvided,
					}
				}
			}
			ignoreErrorsOnFieldsMismatch := new(bool)
			if !streamsItem.Format.CSVFormat.IgnoreErrorsOnFieldsMismatch.IsUnknown() && !streamsItem.Format.CSVFormat.IgnoreErrorsOnFieldsMismatch.IsNull() {
				*ignoreErrorsOnFieldsMismatch = streamsItem.Format.CSVFormat.IgnoreErrorsOnFieldsMismatch.ValueBool()
			} else {
				ignoreErrorsOnFieldsMismatch = nil
			}
			var nullValues []string = []string{}
			for _, nullValuesItem := range streamsItem.Format.CSVFormat.NullValues {
				nullValues = append(nullValues, nullValuesItem.ValueString())
			}
			quoteChar := new(string)
			if !streamsItem.Format.CSVFormat.QuoteChar.IsUnknown() && !streamsItem.Format.CSVFormat.QuoteChar.IsNull() {
				*quoteChar = streamsItem.Format.CSVFormat.QuoteChar.ValueString()
			} else {
				quoteChar = nil
			}
			skipRowsAfterHeader := new(int64)
			if !streamsItem.Format.CSVFormat.SkipRowsAfterHeader.IsUnknown() && !streamsItem.Format.CSVFormat.SkipRowsAfterHeader.IsNull() {
				*skipRowsAfterHeader = streamsItem.Format.CSVFormat.SkipRowsAfterHeader.ValueInt64()
			} else {
				skipRowsAfterHeader = nil
			}
			skipRowsBeforeHeader := new(int64)
			if !streamsItem.Format.CSVFormat.SkipRowsBeforeHeader.IsUnknown() && !streamsItem.Format.CSVFormat.SkipRowsBeforeHeader.IsNull() {
				*skipRowsBeforeHeader = streamsItem.Format.CSVFormat.SkipRowsBeforeHeader.ValueInt64()
			} else {
				skipRowsBeforeHeader = nil
			}
			stringsCanBeNull := new(bool)
			if !streamsItem.Format.CSVFormat.StringsCanBeNull.IsUnknown() && !streamsItem.Format.CSVFormat.StringsCanBeNull.IsNull() {
				*stringsCanBeNull = streamsItem.Format.CSVFormat.StringsCanBeNull.ValueBool()
			} else {
				stringsCanBeNull = nil
			}
			var trueValues []string = []string{}
			for _, trueValuesItem := range streamsItem.Format.CSVFormat.TrueValues {
				trueValues = append(trueValues, trueValuesItem.ValueString())
			}
			sourceSharepointEnterpriseCSVFormat = &shared.SourceSharepointEnterpriseCSVFormat{
				Delimiter:                    delimiter,
				DoubleQuote:                  doubleQuote,
				Encoding:                     encoding,
				EscapeChar:                   escapeChar,
				FalseValues:                  falseValues,
				HeaderDefinition:             headerDefinition,
				IgnoreErrorsOnFieldsMismatch: ignoreErrorsOnFieldsMismatch,
				NullValues:                   nullValues,
				QuoteChar:                    quoteChar,
				SkipRowsAfterHeader:          skipRowsAfterHeader,
				SkipRowsBeforeHeader:         skipRowsBeforeHeader,
				StringsCanBeNull:             stringsCanBeNull,
				TrueValues:                   trueValues,
			}
		}
		if sourceSharepointEnterpriseCSVFormat != nil {
			format = shared.SourceSharepointEnterpriseFormat{
				SourceSharepointEnterpriseCSVFormat: sourceSharepointEnterpriseCSVFormat,
			}
		}
		var sourceSharepointEnterpriseJsonlFormat *shared.SourceSharepointEnterpriseJsonlFormat
		if streamsItem.Format.JsonlFormat != nil {
			sourceSharepointEnterpriseJsonlFormat = &shared.SourceSharepointEnterpriseJsonlFormat{}
		}
		if sourceSharepointEnterpriseJsonlFormat != nil {
			format = shared.SourceSharepointEnterpriseFormat{
				SourceSharepointEnterpriseJsonlFormat: sourceSharepointEnterpriseJsonlFormat,
			}
		}
		var sourceSharepointEnterpriseParquetFormat *shared.SourceSharepointEnterpriseParquetFormat
		if streamsItem.Format.ParquetFormat != nil {
			decimalAsFloat := new(bool)
			if !streamsItem.Format.ParquetFormat.DecimalAsFloat.IsUnknown() && !streamsItem.Format.ParquetFormat.DecimalAsFloat.IsNull() {
				*decimalAsFloat = streamsItem.Format.ParquetFormat.DecimalAsFloat.ValueBool()
			} else {
				decimalAsFloat = nil
			}
			sourceSharepointEnterpriseParquetFormat = &shared.SourceSharepointEnterpriseParquetFormat{
				DecimalAsFloat: decimalAsFloat,
			}
		}
		if sourceSharepointEnterpriseParquetFormat != nil {
			format = shared.SourceSharepointEnterpriseFormat{
				SourceSharepointEnterpriseParquetFormat: sourceSharepointEnterpriseParquetFormat,
			}
		}
		var sourceSharepointEnterpriseUnstructuredDocumentFormat *shared.SourceSharepointEnterpriseUnstructuredDocumentFormat
		if streamsItem.Format.UnstructuredDocumentFormat != nil {
			var processing *shared.SourceSharepointEnterpriseProcessing
			if streamsItem.Format.UnstructuredDocumentFormat.Processing != nil {
				var sourceSharepointEnterpriseLocal *shared.SourceSharepointEnterpriseLocal
				if streamsItem.Format.UnstructuredDocumentFormat.Processing.Local != nil {
					sourceSharepointEnterpriseLocal = &shared.SourceSharepointEnterpriseLocal{}
				}
				if sourceSharepointEnterpriseLocal != nil {
					processing = &shared.SourceSharepointEnterpriseProcessing{
						SourceSharepointEnterpriseLocal: sourceSharepointEnterpriseLocal,
					}
				}
			}
			skipUnprocessableFiles := new(bool)
			if !streamsItem.Format.UnstructuredDocumentFormat.SkipUnprocessableFiles.IsUnknown() && !streamsItem.Format.UnstructuredDocumentFormat.SkipUnprocessableFiles.IsNull() {
				*skipUnprocessableFiles = streamsItem.Format.UnstructuredDocumentFormat.SkipUnprocessableFiles.ValueBool()
			} else {
				skipUnprocessableFiles = nil
			}
			strategy := new(shared.SourceSharepointEnterpriseParsingStrategy)
			if !streamsItem.Format.UnstructuredDocumentFormat.Strategy.IsUnknown() && !streamsItem.Format.UnstructuredDocumentFormat.Strategy.IsNull() {
				*strategy = shared.SourceSharepointEnterpriseParsingStrategy(streamsItem.Format.UnstructuredDocumentFormat.Strategy.ValueString())
			} else {
				strategy = nil
			}
			sourceSharepointEnterpriseUnstructuredDocumentFormat = &shared.SourceSharepointEnterpriseUnstructuredDocumentFormat{
				Processing:             processing,
				SkipUnprocessableFiles: skipUnprocessableFiles,
				Strategy:               strategy,
			}
		}
		if sourceSharepointEnterpriseUnstructuredDocumentFormat != nil {
			format = shared.SourceSharepointEnterpriseFormat{
				SourceSharepointEnterpriseUnstructuredDocumentFormat: sourceSharepointEnterpriseUnstructuredDocumentFormat,
			}
		}
		var sourceSharepointEnterpriseExcelFormat *shared.SourceSharepointEnterpriseExcelFormat
		if streamsItem.Format.ExcelFormat != nil {
			sourceSharepointEnterpriseExcelFormat = &shared.SourceSharepointEnterpriseExcelFormat{}
		}
		if sourceSharepointEnterpriseExcelFormat != nil {
			format = shared.SourceSharepointEnterpriseFormat{
				SourceSharepointEnterpriseExcelFormat: sourceSharepointEnterpriseExcelFormat,
			}
		}
		var globs []string = []string{}
		for _, globsItem := range streamsItem.Globs {
			globs = append(globs, globsItem.ValueString())
		}
		inputSchema := new(string)
		if !streamsItem.InputSchema.IsUnknown() && !streamsItem.InputSchema.IsNull() {
			*inputSchema = streamsItem.InputSchema.ValueString()
		} else {
			inputSchema = nil
		}
		var name1 string
		name1 = streamsItem.Name.ValueString()

		recentNFilesToReadForSchemaDiscovery := new(int64)
		if !streamsItem.RecentNFilesToReadForSchemaDiscovery.IsUnknown() && !streamsItem.RecentNFilesToReadForSchemaDiscovery.IsNull() {
			*recentNFilesToReadForSchemaDiscovery = streamsItem.RecentNFilesToReadForSchemaDiscovery.ValueInt64()
		} else {
			recentNFilesToReadForSchemaDiscovery = nil
		}
		schemaless := new(bool)
		if !streamsItem.Schemaless.IsUnknown() && !streamsItem.Schemaless.IsNull() {
			*schemaless = streamsItem.Schemaless.ValueBool()
		} else {
			schemaless = nil
		}
		validationPolicy := new(shared.SourceSharepointEnterpriseValidationPolicy)
		if !streamsItem.ValidationPolicy.IsUnknown() && !streamsItem.ValidationPolicy.IsNull() {
			*validationPolicy = shared.SourceSharepointEnterpriseValidationPolicy(streamsItem.ValidationPolicy.ValueString())
		} else {
			validationPolicy = nil
		}
		streams = append(streams, shared.SourceSharepointEnterpriseFileBasedStreamConfig{
			DaysToSyncIfHistoryIsFull:            daysToSyncIfHistoryIsFull,
			Format:                               format,
			Globs:                                globs,
			InputSchema:                          inputSchema,
			Name:                                 name1,
			RecentNFilesToReadForSchemaDiscovery: recentNFilesToReadForSchemaDiscovery,
			Schemaless:                           schemaless,
			ValidationPolicy:                     validationPolicy,
		})
	}
	configuration := shared.SourceSharepointEnterprise{
		Credentials:    credentials,
		DeliveryMethod: deliveryMethod,
		FolderPath:     folderPath,
		SearchScope:    searchScope,
		SiteURL:        siteURL,
		StartDate:      startDate,
		Streams:        streams,
	}
	secretID := new(string)
	if !r.SecretID.IsUnknown() && !r.SecretID.IsNull() {
		*secretID = r.SecretID.ValueString()
	} else {
		secretID = nil
	}
	out := shared.SourceSharepointEnterpriseCreateRequest{
		Name:          name,
		DefinitionID:  definitionID,
		WorkspaceID:   workspaceID,
		Configuration: configuration,
		SecretID:      secretID,
	}
	return &out
}

func (r *SourceSharepointEnterpriseResourceModel) RefreshFromSharedSourceResponse(resp *shared.SourceResponse) {
	if resp != nil {
		r.CreatedAt = types.Int64Value(resp.CreatedAt)
		r.DefinitionID = types.StringValue(resp.DefinitionID)
		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.SourceID = types.StringValue(resp.SourceID)
		r.SourceType = types.StringValue(resp.SourceType)
		r.WorkspaceID = types.StringValue(resp.WorkspaceID)
	}
}

func (r *SourceSharepointEnterpriseResourceModel) ToSharedSourceSharepointEnterprisePutRequest() *shared.SourceSharepointEnterprisePutRequest {
	var name string
	name = r.Name.ValueString()

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

	var credentials shared.SourceSharepointEnterpriseUpdateAuthentication
	var sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth *shared.SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth
	if r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth != nil {
		var clientID string
		clientID = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.ClientID.ValueString()

		var clientSecret string
		clientSecret = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.ClientSecret.ValueString()

		refreshToken := new(string)
		if !r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.RefreshToken.IsUnknown() && !r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.RefreshToken.IsNull() {
			*refreshToken = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.RefreshToken.ValueString()
		} else {
			refreshToken = nil
		}
		var tenantID string
		tenantID = r.Configuration.Credentials.AuthenticateViaMicrosoftOAuth.TenantID.ValueString()

		sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth = &shared.SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth{
			ClientID:     clientID,
			ClientSecret: clientSecret,
			RefreshToken: refreshToken,
			TenantID:     tenantID,
		}
	}
	if sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth != nil {
		credentials = shared.SourceSharepointEnterpriseUpdateAuthentication{
			SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth: sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth,
		}
	}
	var sourceSharepointEnterpriseUpdateServiceKeyAuthentication *shared.SourceSharepointEnterpriseUpdateServiceKeyAuthentication
	if r.Configuration.Credentials.ServiceKeyAuthentication != nil {
		var clientId1 string
		clientId1 = r.Configuration.Credentials.ServiceKeyAuthentication.ClientID.ValueString()

		var clientSecret1 string
		clientSecret1 = r.Configuration.Credentials.ServiceKeyAuthentication.ClientSecret.ValueString()

		var tenantId1 string
		tenantId1 = r.Configuration.Credentials.ServiceKeyAuthentication.TenantID.ValueString()

		var userPrincipalName string
		userPrincipalName = r.Configuration.Credentials.ServiceKeyAuthentication.UserPrincipalName.ValueString()

		sourceSharepointEnterpriseUpdateServiceKeyAuthentication = &shared.SourceSharepointEnterpriseUpdateServiceKeyAuthentication{
			ClientID:          clientId1,
			ClientSecret:      clientSecret1,
			TenantID:          tenantId1,
			UserPrincipalName: userPrincipalName,
		}
	}
	if sourceSharepointEnterpriseUpdateServiceKeyAuthentication != nil {
		credentials = shared.SourceSharepointEnterpriseUpdateAuthentication{
			SourceSharepointEnterpriseUpdateServiceKeyAuthentication: sourceSharepointEnterpriseUpdateServiceKeyAuthentication,
		}
	}
	var deliveryMethod *shared.SourceSharepointEnterpriseUpdateDeliveryMethod
	if r.Configuration.DeliveryMethod != nil {
		var sourceSharepointEnterpriseUpdateReplicateRecords *shared.SourceSharepointEnterpriseUpdateReplicateRecords
		if r.Configuration.DeliveryMethod.ReplicateRecords != nil {
			sourceSharepointEnterpriseUpdateReplicateRecords = &shared.SourceSharepointEnterpriseUpdateReplicateRecords{}
		}
		if sourceSharepointEnterpriseUpdateReplicateRecords != nil {
			deliveryMethod = &shared.SourceSharepointEnterpriseUpdateDeliveryMethod{
				SourceSharepointEnterpriseUpdateReplicateRecords: sourceSharepointEnterpriseUpdateReplicateRecords,
			}
		}
		var sourceSharepointEnterpriseUpdateCopyRawFiles *shared.SourceSharepointEnterpriseUpdateCopyRawFiles
		if r.Configuration.DeliveryMethod.CopyRawFiles != nil {
			preserveDirectoryStructure := new(bool)
			if !r.Configuration.DeliveryMethod.CopyRawFiles.PreserveDirectoryStructure.IsUnknown() && !r.Configuration.DeliveryMethod.CopyRawFiles.PreserveDirectoryStructure.IsNull() {
				*preserveDirectoryStructure = r.Configuration.DeliveryMethod.CopyRawFiles.PreserveDirectoryStructure.ValueBool()
			} else {
				preserveDirectoryStructure = nil
			}
			sourceSharepointEnterpriseUpdateCopyRawFiles = &shared.SourceSharepointEnterpriseUpdateCopyRawFiles{
				PreserveDirectoryStructure: preserveDirectoryStructure,
			}
		}
		if sourceSharepointEnterpriseUpdateCopyRawFiles != nil {
			deliveryMethod = &shared.SourceSharepointEnterpriseUpdateDeliveryMethod{
				SourceSharepointEnterpriseUpdateCopyRawFiles: sourceSharepointEnterpriseUpdateCopyRawFiles,
			}
		}
		var sourceSharepointEnterpriseUpdateReplicatePermissionsACL *shared.SourceSharepointEnterpriseUpdateReplicatePermissionsACL
		if r.Configuration.DeliveryMethod.ReplicatePermissionsACL != nil {
			includeIdentitiesStream := new(bool)
			if !r.Configuration.DeliveryMethod.ReplicatePermissionsACL.IncludeIdentitiesStream.IsUnknown() && !r.Configuration.DeliveryMethod.ReplicatePermissionsACL.IncludeIdentitiesStream.IsNull() {
				*includeIdentitiesStream = r.Configuration.DeliveryMethod.ReplicatePermissionsACL.IncludeIdentitiesStream.ValueBool()
			} else {
				includeIdentitiesStream = nil
			}
			sourceSharepointEnterpriseUpdateReplicatePermissionsACL = &shared.SourceSharepointEnterpriseUpdateReplicatePermissionsACL{
				IncludeIdentitiesStream: includeIdentitiesStream,
			}
		}
		if sourceSharepointEnterpriseUpdateReplicatePermissionsACL != nil {
			deliveryMethod = &shared.SourceSharepointEnterpriseUpdateDeliveryMethod{
				SourceSharepointEnterpriseUpdateReplicatePermissionsACL: sourceSharepointEnterpriseUpdateReplicatePermissionsACL,
			}
		}
	}
	folderPath := new(string)
	if !r.Configuration.FolderPath.IsUnknown() && !r.Configuration.FolderPath.IsNull() {
		*folderPath = r.Configuration.FolderPath.ValueString()
	} else {
		folderPath = nil
	}
	searchScope := new(shared.SourceSharepointEnterpriseUpdateSearchScope)
	if !r.Configuration.SearchScope.IsUnknown() && !r.Configuration.SearchScope.IsNull() {
		*searchScope = shared.SourceSharepointEnterpriseUpdateSearchScope(r.Configuration.SearchScope.ValueString())
	} else {
		searchScope = nil
	}
	siteURL := new(string)
	if !r.Configuration.SiteURL.IsUnknown() && !r.Configuration.SiteURL.IsNull() {
		*siteURL = r.Configuration.SiteURL.ValueString()
	} else {
		siteURL = nil
	}
	startDate := new(time.Time)
	if !r.Configuration.StartDate.IsUnknown() && !r.Configuration.StartDate.IsNull() {
		*startDate, _ = time.Parse(time.RFC3339Nano, r.Configuration.StartDate.ValueString())
	} else {
		startDate = nil
	}
	var streams []shared.SourceSharepointEnterpriseUpdateFileBasedStreamConfig = []shared.SourceSharepointEnterpriseUpdateFileBasedStreamConfig{}
	for _, streamsItem := range r.Configuration.Streams {
		daysToSyncIfHistoryIsFull := new(int64)
		if !streamsItem.DaysToSyncIfHistoryIsFull.IsUnknown() && !streamsItem.DaysToSyncIfHistoryIsFull.IsNull() {
			*daysToSyncIfHistoryIsFull = streamsItem.DaysToSyncIfHistoryIsFull.ValueInt64()
		} else {
			daysToSyncIfHistoryIsFull = nil
		}
		var format shared.SourceSharepointEnterpriseUpdateFormat
		var sourceSharepointEnterpriseUpdateAvroFormat *shared.SourceSharepointEnterpriseUpdateAvroFormat
		if streamsItem.Format.AvroFormat != nil {
			doubleAsString := new(bool)
			if !streamsItem.Format.AvroFormat.DoubleAsString.IsUnknown() && !streamsItem.Format.AvroFormat.DoubleAsString.IsNull() {
				*doubleAsString = streamsItem.Format.AvroFormat.DoubleAsString.ValueBool()
			} else {
				doubleAsString = nil
			}
			sourceSharepointEnterpriseUpdateAvroFormat = &shared.SourceSharepointEnterpriseUpdateAvroFormat{
				DoubleAsString: doubleAsString,
			}
		}
		if sourceSharepointEnterpriseUpdateAvroFormat != nil {
			format = shared.SourceSharepointEnterpriseUpdateFormat{
				SourceSharepointEnterpriseUpdateAvroFormat: sourceSharepointEnterpriseUpdateAvroFormat,
			}
		}
		var sourceSharepointEnterpriseUpdateCSVFormat *shared.SourceSharepointEnterpriseUpdateCSVFormat
		if streamsItem.Format.CSVFormat != nil {
			delimiter := new(string)
			if !streamsItem.Format.CSVFormat.Delimiter.IsUnknown() && !streamsItem.Format.CSVFormat.Delimiter.IsNull() {
				*delimiter = streamsItem.Format.CSVFormat.Delimiter.ValueString()
			} else {
				delimiter = nil
			}
			doubleQuote := new(bool)
			if !streamsItem.Format.CSVFormat.DoubleQuote.IsUnknown() && !streamsItem.Format.CSVFormat.DoubleQuote.IsNull() {
				*doubleQuote = streamsItem.Format.CSVFormat.DoubleQuote.ValueBool()
			} else {
				doubleQuote = nil
			}
			encoding := new(string)
			if !streamsItem.Format.CSVFormat.Encoding.IsUnknown() && !streamsItem.Format.CSVFormat.Encoding.IsNull() {
				*encoding = streamsItem.Format.CSVFormat.Encoding.ValueString()
			} else {
				encoding = nil
			}
			escapeChar := new(string)
			if !streamsItem.Format.CSVFormat.EscapeChar.IsUnknown() && !streamsItem.Format.CSVFormat.EscapeChar.IsNull() {
				*escapeChar = streamsItem.Format.CSVFormat.EscapeChar.ValueString()
			} else {
				escapeChar = nil
			}
			var falseValues []string = []string{}
			for _, falseValuesItem := range streamsItem.Format.CSVFormat.FalseValues {
				falseValues = append(falseValues, falseValuesItem.ValueString())
			}
			var headerDefinition *shared.SourceSharepointEnterpriseUpdateCSVHeaderDefinition
			if streamsItem.Format.CSVFormat.HeaderDefinition != nil {
				var sourceSharepointEnterpriseUpdateFromCSV *shared.SourceSharepointEnterpriseUpdateFromCSV
				if streamsItem.Format.CSVFormat.HeaderDefinition.FromCSV != nil {
					sourceSharepointEnterpriseUpdateFromCSV = &shared.SourceSharepointEnterpriseUpdateFromCSV{}
				}
				if sourceSharepointEnterpriseUpdateFromCSV != nil {
					headerDefinition = &shared.SourceSharepointEnterpriseUpdateCSVHeaderDefinition{
						SourceSharepointEnterpriseUpdateFromCSV: sourceSharepointEnterpriseUpdateFromCSV,
					}
				}
				var sourceSharepointEnterpriseUpdateAutogenerated *shared.SourceSharepointEnterpriseUpdateAutogenerated
				if streamsItem.Format.CSVFormat.HeaderDefinition.Autogenerated != nil {
					sourceSharepointEnterpriseUpdateAutogenerated = &shared.SourceSharepointEnterpriseUpdateAutogenerated{}
				}
				if sourceSharepointEnterpriseUpdateAutogenerated != nil {
					headerDefinition = &shared.SourceSharepointEnterpriseUpdateCSVHeaderDefinition{
						SourceSharepointEnterpriseUpdateAutogenerated: sourceSharepointEnterpriseUpdateAutogenerated,
					}
				}
				var sourceSharepointEnterpriseUpdateUserProvided *shared.SourceSharepointEnterpriseUpdateUserProvided
				if streamsItem.Format.CSVFormat.HeaderDefinition.UserProvided != nil {
					var columnNames []string = []string{}
					for _, columnNamesItem := range streamsItem.Format.CSVFormat.HeaderDefinition.UserProvided.ColumnNames {
						columnNames = append(columnNames, columnNamesItem.ValueString())
					}
					sourceSharepointEnterpriseUpdateUserProvided = &shared.SourceSharepointEnterpriseUpdateUserProvided{
						ColumnNames: columnNames,
					}
				}
				if sourceSharepointEnterpriseUpdateUserProvided != nil {
					headerDefinition = &shared.SourceSharepointEnterpriseUpdateCSVHeaderDefinition{
						SourceSharepointEnterpriseUpdateUserProvided: sourceSharepointEnterpriseUpdateUserProvided,
					}
				}
			}
			ignoreErrorsOnFieldsMismatch := new(bool)
			if !streamsItem.Format.CSVFormat.IgnoreErrorsOnFieldsMismatch.IsUnknown() && !streamsItem.Format.CSVFormat.IgnoreErrorsOnFieldsMismatch.IsNull() {
				*ignoreErrorsOnFieldsMismatch = streamsItem.Format.CSVFormat.IgnoreErrorsOnFieldsMismatch.ValueBool()
			} else {
				ignoreErrorsOnFieldsMismatch = nil
			}
			var nullValues []string = []string{}
			for _, nullValuesItem := range streamsItem.Format.CSVFormat.NullValues {
				nullValues = append(nullValues, nullValuesItem.ValueString())
			}
			quoteChar := new(string)
			if !streamsItem.Format.CSVFormat.QuoteChar.IsUnknown() && !streamsItem.Format.CSVFormat.QuoteChar.IsNull() {
				*quoteChar = streamsItem.Format.CSVFormat.QuoteChar.ValueString()
			} else {
				quoteChar = nil
			}
			skipRowsAfterHeader := new(int64)
			if !streamsItem.Format.CSVFormat.SkipRowsAfterHeader.IsUnknown() && !streamsItem.Format.CSVFormat.SkipRowsAfterHeader.IsNull() {
				*skipRowsAfterHeader = streamsItem.Format.CSVFormat.SkipRowsAfterHeader.ValueInt64()
			} else {
				skipRowsAfterHeader = nil
			}
			skipRowsBeforeHeader := new(int64)
			if !streamsItem.Format.CSVFormat.SkipRowsBeforeHeader.IsUnknown() && !streamsItem.Format.CSVFormat.SkipRowsBeforeHeader.IsNull() {
				*skipRowsBeforeHeader = streamsItem.Format.CSVFormat.SkipRowsBeforeHeader.ValueInt64()
			} else {
				skipRowsBeforeHeader = nil
			}
			stringsCanBeNull := new(bool)
			if !streamsItem.Format.CSVFormat.StringsCanBeNull.IsUnknown() && !streamsItem.Format.CSVFormat.StringsCanBeNull.IsNull() {
				*stringsCanBeNull = streamsItem.Format.CSVFormat.StringsCanBeNull.ValueBool()
			} else {
				stringsCanBeNull = nil
			}
			var trueValues []string = []string{}
			for _, trueValuesItem := range streamsItem.Format.CSVFormat.TrueValues {
				trueValues = append(trueValues, trueValuesItem.ValueString())
			}
			sourceSharepointEnterpriseUpdateCSVFormat = &shared.SourceSharepointEnterpriseUpdateCSVFormat{
				Delimiter:                    delimiter,
				DoubleQuote:                  doubleQuote,
				Encoding:                     encoding,
				EscapeChar:                   escapeChar,
				FalseValues:                  falseValues,
				HeaderDefinition:             headerDefinition,
				IgnoreErrorsOnFieldsMismatch: ignoreErrorsOnFieldsMismatch,
				NullValues:                   nullValues,
				QuoteChar:                    quoteChar,
				SkipRowsAfterHeader:          skipRowsAfterHeader,
				SkipRowsBeforeHeader:         skipRowsBeforeHeader,
				StringsCanBeNull:             stringsCanBeNull,
				TrueValues:                   trueValues,
			}
		}
		if sourceSharepointEnterpriseUpdateCSVFormat != nil {
			format = shared.SourceSharepointEnterpriseUpdateFormat{
				SourceSharepointEnterpriseUpdateCSVFormat: sourceSharepointEnterpriseUpdateCSVFormat,
			}
		}
		var sourceSharepointEnterpriseUpdateJsonlFormat *shared.SourceSharepointEnterpriseUpdateJsonlFormat
		if streamsItem.Format.JsonlFormat != nil {
			sourceSharepointEnterpriseUpdateJsonlFormat = &shared.SourceSharepointEnterpriseUpdateJsonlFormat{}
		}
		if sourceSharepointEnterpriseUpdateJsonlFormat != nil {
			format = shared.SourceSharepointEnterpriseUpdateFormat{
				SourceSharepointEnterpriseUpdateJsonlFormat: sourceSharepointEnterpriseUpdateJsonlFormat,
			}
		}
		var sourceSharepointEnterpriseUpdateParquetFormat *shared.SourceSharepointEnterpriseUpdateParquetFormat
		if streamsItem.Format.ParquetFormat != nil {
			decimalAsFloat := new(bool)
			if !streamsItem.Format.ParquetFormat.DecimalAsFloat.IsUnknown() && !streamsItem.Format.ParquetFormat.DecimalAsFloat.IsNull() {
				*decimalAsFloat = streamsItem.Format.ParquetFormat.DecimalAsFloat.ValueBool()
			} else {
				decimalAsFloat = nil
			}
			sourceSharepointEnterpriseUpdateParquetFormat = &shared.SourceSharepointEnterpriseUpdateParquetFormat{
				DecimalAsFloat: decimalAsFloat,
			}
		}
		if sourceSharepointEnterpriseUpdateParquetFormat != nil {
			format = shared.SourceSharepointEnterpriseUpdateFormat{
				SourceSharepointEnterpriseUpdateParquetFormat: sourceSharepointEnterpriseUpdateParquetFormat,
			}
		}
		var sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat *shared.SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat
		if streamsItem.Format.UnstructuredDocumentFormat != nil {
			var processing *shared.SourceSharepointEnterpriseUpdateProcessing
			if streamsItem.Format.UnstructuredDocumentFormat.Processing != nil {
				var sourceSharepointEnterpriseUpdateLocal *shared.SourceSharepointEnterpriseUpdateLocal
				if streamsItem.Format.UnstructuredDocumentFormat.Processing.Local != nil {
					sourceSharepointEnterpriseUpdateLocal = &shared.SourceSharepointEnterpriseUpdateLocal{}
				}
				if sourceSharepointEnterpriseUpdateLocal != nil {
					processing = &shared.SourceSharepointEnterpriseUpdateProcessing{
						SourceSharepointEnterpriseUpdateLocal: sourceSharepointEnterpriseUpdateLocal,
					}
				}
			}
			skipUnprocessableFiles := new(bool)
			if !streamsItem.Format.UnstructuredDocumentFormat.SkipUnprocessableFiles.IsUnknown() && !streamsItem.Format.UnstructuredDocumentFormat.SkipUnprocessableFiles.IsNull() {
				*skipUnprocessableFiles = streamsItem.Format.UnstructuredDocumentFormat.SkipUnprocessableFiles.ValueBool()
			} else {
				skipUnprocessableFiles = nil
			}
			strategy := new(shared.SourceSharepointEnterpriseUpdateParsingStrategy)
			if !streamsItem.Format.UnstructuredDocumentFormat.Strategy.IsUnknown() && !streamsItem.Format.UnstructuredDocumentFormat.Strategy.IsNull() {
				*strategy = shared.SourceSharepointEnterpriseUpdateParsingStrategy(streamsItem.Format.UnstructuredDocumentFormat.Strategy.ValueString())
			} else {
				strategy = nil
			}
			sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat = &shared.SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat{
				Processing:             processing,
				SkipUnprocessableFiles: skipUnprocessableFiles,
				Strategy:               strategy,
			}
		}
		if sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat != nil {
			format = shared.SourceSharepointEnterpriseUpdateFormat{
				SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat: sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat,
			}
		}
		var sourceSharepointEnterpriseUpdateExcelFormat *shared.SourceSharepointEnterpriseUpdateExcelFormat
		if streamsItem.Format.ExcelFormat != nil {
			sourceSharepointEnterpriseUpdateExcelFormat = &shared.SourceSharepointEnterpriseUpdateExcelFormat{}
		}
		if sourceSharepointEnterpriseUpdateExcelFormat != nil {
			format = shared.SourceSharepointEnterpriseUpdateFormat{
				SourceSharepointEnterpriseUpdateExcelFormat: sourceSharepointEnterpriseUpdateExcelFormat,
			}
		}
		var globs []string = []string{}
		for _, globsItem := range streamsItem.Globs {
			globs = append(globs, globsItem.ValueString())
		}
		inputSchema := new(string)
		if !streamsItem.InputSchema.IsUnknown() && !streamsItem.InputSchema.IsNull() {
			*inputSchema = streamsItem.InputSchema.ValueString()
		} else {
			inputSchema = nil
		}
		var name1 string
		name1 = streamsItem.Name.ValueString()

		recentNFilesToReadForSchemaDiscovery := new(int64)
		if !streamsItem.RecentNFilesToReadForSchemaDiscovery.IsUnknown() && !streamsItem.RecentNFilesToReadForSchemaDiscovery.IsNull() {
			*recentNFilesToReadForSchemaDiscovery = streamsItem.RecentNFilesToReadForSchemaDiscovery.ValueInt64()
		} else {
			recentNFilesToReadForSchemaDiscovery = nil
		}
		schemaless := new(bool)
		if !streamsItem.Schemaless.IsUnknown() && !streamsItem.Schemaless.IsNull() {
			*schemaless = streamsItem.Schemaless.ValueBool()
		} else {
			schemaless = nil
		}
		validationPolicy := new(shared.SourceSharepointEnterpriseUpdateValidationPolicy)
		if !streamsItem.ValidationPolicy.IsUnknown() && !streamsItem.ValidationPolicy.IsNull() {
			*validationPolicy = shared.SourceSharepointEnterpriseUpdateValidationPolicy(streamsItem.ValidationPolicy.ValueString())
		} else {
			validationPolicy = nil
		}
		streams = append(streams, shared.SourceSharepointEnterpriseUpdateFileBasedStreamConfig{
			DaysToSyncIfHistoryIsFull:            daysToSyncIfHistoryIsFull,
			Format:                               format,
			Globs:                                globs,
			InputSchema:                          inputSchema,
			Name:                                 name1,
			RecentNFilesToReadForSchemaDiscovery: recentNFilesToReadForSchemaDiscovery,
			Schemaless:                           schemaless,
			ValidationPolicy:                     validationPolicy,
		})
	}
	configuration := shared.SourceSharepointEnterpriseUpdate{
		Credentials:    credentials,
		DeliveryMethod: deliveryMethod,
		FolderPath:     folderPath,
		SearchScope:    searchScope,
		SiteURL:        siteURL,
		StartDate:      startDate,
		Streams:        streams,
	}
	out := shared.SourceSharepointEnterprisePutRequest{
		Name:          name,
		WorkspaceID:   workspaceID,
		Configuration: configuration,
	}
	return &out
}
