// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package armworkloadorchestration

import (
	"context"
	"errors"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
	"net/http"
	"net/url"
	"strings"
)

// DynamicSchemaVersionsClient contains the methods for the DynamicSchemaVersions group.
// Don't use this type directly, use NewDynamicSchemaVersionsClient() instead.
type DynamicSchemaVersionsClient struct {
	internal       *arm.Client
	subscriptionID string
}

// NewDynamicSchemaVersionsClient creates a new instance of DynamicSchemaVersionsClient with the specified values.
//   - subscriptionID - The ID of the target subscription. The value must be an UUID.
//   - credential - used to authorize requests. Usually a credential from azidentity.
//   - options - pass nil to accept the default values.
func NewDynamicSchemaVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DynamicSchemaVersionsClient, error) {
	cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
	if err != nil {
		return nil, err
	}
	client := &DynamicSchemaVersionsClient{
		subscriptionID: subscriptionID,
		internal:       cl,
	}
	return client, nil
}

// BeginCreateOrUpdate - Create or update a Dynamic Schema Version Resource
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2025-06-01
//   - resourceGroupName - The name of the resource group. The name is case insensitive.
//   - schemaName - The name of the Schema
//   - dynamicSchemaName - The name of the DynamicSchema
//   - dynamicSchemaVersionName - The name of the DynamicSchemaVersion
//   - resource - Resource create parameters.
//   - options - DynamicSchemaVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DynamicSchemaVersionsClient.BeginCreateOrUpdate
//     method.
func (client *DynamicSchemaVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, resource DynamicSchemaVersion, options *DynamicSchemaVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DynamicSchemaVersionsClientCreateOrUpdateResponse], error) {
	if options == nil || options.ResumeToken == "" {
		resp, err := client.createOrUpdate(ctx, resourceGroupName, schemaName, dynamicSchemaName, dynamicSchemaVersionName, resource, options)
		if err != nil {
			return nil, err
		}
		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DynamicSchemaVersionsClientCreateOrUpdateResponse]{
			Tracer: client.internal.Tracer(),
		})
		return poller, err
	} else {
		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DynamicSchemaVersionsClientCreateOrUpdateResponse]{
			Tracer: client.internal.Tracer(),
		})
	}
}

// CreateOrUpdate - Create or update a Dynamic Schema Version Resource
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2025-06-01
func (client *DynamicSchemaVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, resource DynamicSchemaVersion, options *DynamicSchemaVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) {
	var err error
	const operationName = "DynamicSchemaVersionsClient.BeginCreateOrUpdate"
	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
	defer func() { endSpan(err) }()
	req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, schemaName, dynamicSchemaName, dynamicSchemaVersionName, resource, options)
	if err != nil {
		return nil, err
	}
	httpResp, err := client.internal.Pipeline().Do(req)
	if err != nil {
		return nil, err
	}
	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
		err = runtime.NewResponseError(httpResp)
		return nil, err
	}
	return httpResp, nil
}

// createOrUpdateCreateRequest creates the CreateOrUpdate request.
func (client *DynamicSchemaVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, resource DynamicSchemaVersion, _ *DynamicSchemaVersionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/schemas/{schemaName}/dynamicSchemas/{dynamicSchemaName}/versions/{dynamicSchemaVersionName}"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if schemaName == "" {
		return nil, errors.New("parameter schemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{schemaName}", url.PathEscape(schemaName))
	if dynamicSchemaName == "" {
		return nil, errors.New("parameter dynamicSchemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaName}", url.PathEscape(dynamicSchemaName))
	if dynamicSchemaVersionName == "" {
		return nil, errors.New("parameter dynamicSchemaVersionName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaVersionName}", url.PathEscape(dynamicSchemaVersionName))
	req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2025-06-01")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	req.Raw().Header["Content-Type"] = []string{"application/json"}
	if err := runtime.MarshalAsJSON(req, resource); err != nil {
		return nil, err
	}
	return req, nil
}

// BeginDelete - Delete a Dynamic Schema Version Resource
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2025-06-01
//   - resourceGroupName - The name of the resource group. The name is case insensitive.
//   - schemaName - The name of the Schema
//   - dynamicSchemaName - The name of the DynamicSchema
//   - dynamicSchemaVersionName - The name of the DynamicSchemaVersion
//   - options - DynamicSchemaVersionsClientBeginDeleteOptions contains the optional parameters for the DynamicSchemaVersionsClient.BeginDelete
//     method.
func (client *DynamicSchemaVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, options *DynamicSchemaVersionsClientBeginDeleteOptions) (*runtime.Poller[DynamicSchemaVersionsClientDeleteResponse], error) {
	if options == nil || options.ResumeToken == "" {
		resp, err := client.deleteOperation(ctx, resourceGroupName, schemaName, dynamicSchemaName, dynamicSchemaVersionName, options)
		if err != nil {
			return nil, err
		}
		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DynamicSchemaVersionsClientDeleteResponse]{
			Tracer: client.internal.Tracer(),
		})
		return poller, err
	} else {
		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DynamicSchemaVersionsClientDeleteResponse]{
			Tracer: client.internal.Tracer(),
		})
	}
}

// Delete - Delete a Dynamic Schema Version Resource
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2025-06-01
func (client *DynamicSchemaVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, options *DynamicSchemaVersionsClientBeginDeleteOptions) (*http.Response, error) {
	var err error
	const operationName = "DynamicSchemaVersionsClient.BeginDelete"
	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
	defer func() { endSpan(err) }()
	req, err := client.deleteCreateRequest(ctx, resourceGroupName, schemaName, dynamicSchemaName, dynamicSchemaVersionName, options)
	if err != nil {
		return nil, err
	}
	httpResp, err := client.internal.Pipeline().Do(req)
	if err != nil {
		return nil, err
	}
	if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
		err = runtime.NewResponseError(httpResp)
		return nil, err
	}
	return httpResp, nil
}

// deleteCreateRequest creates the Delete request.
func (client *DynamicSchemaVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, _ *DynamicSchemaVersionsClientBeginDeleteOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/schemas/{schemaName}/dynamicSchemas/{dynamicSchemaName}/versions/{dynamicSchemaVersionName}"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if schemaName == "" {
		return nil, errors.New("parameter schemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{schemaName}", url.PathEscape(schemaName))
	if dynamicSchemaName == "" {
		return nil, errors.New("parameter dynamicSchemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaName}", url.PathEscape(dynamicSchemaName))
	if dynamicSchemaVersionName == "" {
		return nil, errors.New("parameter dynamicSchemaVersionName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaVersionName}", url.PathEscape(dynamicSchemaVersionName))
	req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2025-06-01")
	req.Raw().URL.RawQuery = reqQP.Encode()
	return req, nil
}

// Get - Get a Dynamic Schema Version Resource
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2025-06-01
//   - resourceGroupName - The name of the resource group. The name is case insensitive.
//   - schemaName - The name of the Schema
//   - dynamicSchemaName - The name of the DynamicSchema
//   - dynamicSchemaVersionName - The name of the DynamicSchemaVersion
//   - options - DynamicSchemaVersionsClientGetOptions contains the optional parameters for the DynamicSchemaVersionsClient.Get
//     method.
func (client *DynamicSchemaVersionsClient) Get(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, options *DynamicSchemaVersionsClientGetOptions) (DynamicSchemaVersionsClientGetResponse, error) {
	var err error
	const operationName = "DynamicSchemaVersionsClient.Get"
	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
	defer func() { endSpan(err) }()
	req, err := client.getCreateRequest(ctx, resourceGroupName, schemaName, dynamicSchemaName, dynamicSchemaVersionName, options)
	if err != nil {
		return DynamicSchemaVersionsClientGetResponse{}, err
	}
	httpResp, err := client.internal.Pipeline().Do(req)
	if err != nil {
		return DynamicSchemaVersionsClientGetResponse{}, err
	}
	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
		err = runtime.NewResponseError(httpResp)
		return DynamicSchemaVersionsClientGetResponse{}, err
	}
	resp, err := client.getHandleResponse(httpResp)
	return resp, err
}

// getCreateRequest creates the Get request.
func (client *DynamicSchemaVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, _ *DynamicSchemaVersionsClientGetOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/schemas/{schemaName}/dynamicSchemas/{dynamicSchemaName}/versions/{dynamicSchemaVersionName}"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if schemaName == "" {
		return nil, errors.New("parameter schemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{schemaName}", url.PathEscape(schemaName))
	if dynamicSchemaName == "" {
		return nil, errors.New("parameter dynamicSchemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaName}", url.PathEscape(dynamicSchemaName))
	if dynamicSchemaVersionName == "" {
		return nil, errors.New("parameter dynamicSchemaVersionName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaVersionName}", url.PathEscape(dynamicSchemaVersionName))
	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2025-06-01")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	return req, nil
}

// getHandleResponse handles the Get response.
func (client *DynamicSchemaVersionsClient) getHandleResponse(resp *http.Response) (DynamicSchemaVersionsClientGetResponse, error) {
	result := DynamicSchemaVersionsClientGetResponse{}
	if err := runtime.UnmarshalAsJSON(resp, &result.DynamicSchemaVersion); err != nil {
		return DynamicSchemaVersionsClientGetResponse{}, err
	}
	return result, nil
}

// NewListByDynamicSchemaPager - List by Dynamic Schema
//
// Generated from API version 2025-06-01
//   - resourceGroupName - The name of the resource group. The name is case insensitive.
//   - schemaName - The name of the Schema
//   - dynamicSchemaName - The name of the DynamicSchema
//   - options - DynamicSchemaVersionsClientListByDynamicSchemaOptions contains the optional parameters for the DynamicSchemaVersionsClient.NewListByDynamicSchemaPager
//     method.
func (client *DynamicSchemaVersionsClient) NewListByDynamicSchemaPager(resourceGroupName string, schemaName string, dynamicSchemaName string, options *DynamicSchemaVersionsClientListByDynamicSchemaOptions) *runtime.Pager[DynamicSchemaVersionsClientListByDynamicSchemaResponse] {
	return runtime.NewPager(runtime.PagingHandler[DynamicSchemaVersionsClientListByDynamicSchemaResponse]{
		More: func(page DynamicSchemaVersionsClientListByDynamicSchemaResponse) bool {
			return page.NextLink != nil && len(*page.NextLink) > 0
		},
		Fetcher: func(ctx context.Context, page *DynamicSchemaVersionsClientListByDynamicSchemaResponse) (DynamicSchemaVersionsClientListByDynamicSchemaResponse, error) {
			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DynamicSchemaVersionsClient.NewListByDynamicSchemaPager")
			nextLink := ""
			if page != nil {
				nextLink = *page.NextLink
			}
			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
				return client.listByDynamicSchemaCreateRequest(ctx, resourceGroupName, schemaName, dynamicSchemaName, options)
			}, nil)
			if err != nil {
				return DynamicSchemaVersionsClientListByDynamicSchemaResponse{}, err
			}
			return client.listByDynamicSchemaHandleResponse(resp)
		},
		Tracer: client.internal.Tracer(),
	})
}

// listByDynamicSchemaCreateRequest creates the ListByDynamicSchema request.
func (client *DynamicSchemaVersionsClient) listByDynamicSchemaCreateRequest(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, _ *DynamicSchemaVersionsClientListByDynamicSchemaOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/schemas/{schemaName}/dynamicSchemas/{dynamicSchemaName}/versions"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if schemaName == "" {
		return nil, errors.New("parameter schemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{schemaName}", url.PathEscape(schemaName))
	if dynamicSchemaName == "" {
		return nil, errors.New("parameter dynamicSchemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaName}", url.PathEscape(dynamicSchemaName))
	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2025-06-01")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	return req, nil
}

// listByDynamicSchemaHandleResponse handles the ListByDynamicSchema response.
func (client *DynamicSchemaVersionsClient) listByDynamicSchemaHandleResponse(resp *http.Response) (DynamicSchemaVersionsClientListByDynamicSchemaResponse, error) {
	result := DynamicSchemaVersionsClientListByDynamicSchemaResponse{}
	if err := runtime.UnmarshalAsJSON(resp, &result.DynamicSchemaVersionListResult); err != nil {
		return DynamicSchemaVersionsClientListByDynamicSchemaResponse{}, err
	}
	return result, nil
}

// Update - update a Dynamic Schema Version Resource
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2025-06-01
//   - resourceGroupName - The name of the resource group. The name is case insensitive.
//   - schemaName - The name of the Schema
//   - dynamicSchemaName - The name of the DynamicSchema
//   - dynamicSchemaVersionName - The name of the DynamicSchemaVersion
//   - properties - The resource properties to be updated.
//   - options - DynamicSchemaVersionsClientUpdateOptions contains the optional parameters for the DynamicSchemaVersionsClient.Update
//     method.
func (client *DynamicSchemaVersionsClient) Update(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, properties DynamicSchemaVersion, options *DynamicSchemaVersionsClientUpdateOptions) (DynamicSchemaVersionsClientUpdateResponse, error) {
	var err error
	const operationName = "DynamicSchemaVersionsClient.Update"
	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
	defer func() { endSpan(err) }()
	req, err := client.updateCreateRequest(ctx, resourceGroupName, schemaName, dynamicSchemaName, dynamicSchemaVersionName, properties, options)
	if err != nil {
		return DynamicSchemaVersionsClientUpdateResponse{}, err
	}
	httpResp, err := client.internal.Pipeline().Do(req)
	if err != nil {
		return DynamicSchemaVersionsClientUpdateResponse{}, err
	}
	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
		err = runtime.NewResponseError(httpResp)
		return DynamicSchemaVersionsClientUpdateResponse{}, err
	}
	resp, err := client.updateHandleResponse(httpResp)
	return resp, err
}

// updateCreateRequest creates the Update request.
func (client *DynamicSchemaVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, schemaName string, dynamicSchemaName string, dynamicSchemaVersionName string, properties DynamicSchemaVersion, _ *DynamicSchemaVersionsClientUpdateOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/schemas/{schemaName}/dynamicSchemas/{dynamicSchemaName}/versions/{dynamicSchemaVersionName}"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if schemaName == "" {
		return nil, errors.New("parameter schemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{schemaName}", url.PathEscape(schemaName))
	if dynamicSchemaName == "" {
		return nil, errors.New("parameter dynamicSchemaName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaName}", url.PathEscape(dynamicSchemaName))
	if dynamicSchemaVersionName == "" {
		return nil, errors.New("parameter dynamicSchemaVersionName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{dynamicSchemaVersionName}", url.PathEscape(dynamicSchemaVersionName))
	req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2025-06-01")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	req.Raw().Header["Content-Type"] = []string{"application/json"}
	if err := runtime.MarshalAsJSON(req, properties); err != nil {
		return nil, err
	}
	return req, nil
}

// updateHandleResponse handles the Update response.
func (client *DynamicSchemaVersionsClient) updateHandleResponse(resp *http.Response) (DynamicSchemaVersionsClientUpdateResponse, error) {
	result := DynamicSchemaVersionsClientUpdateResponse{}
	if err := runtime.UnmarshalAsJSON(resp, &result.DynamicSchemaVersion); err != nil {
		return DynamicSchemaVersionsClientUpdateResponse{}, err
	}
	return result, nil
}
