// 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) AutoRest Code Generator. DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

package armfluxconfigurations

import (
	"encoding/json"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"reflect"
)

// MarshalJSON implements the json.Marshaller interface for type AzureBlobDefinition.
func (a AzureBlobDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "accountKey", a.AccountKey)
	populate(objectMap, "containerName", a.ContainerName)
	populate(objectMap, "localAuthRef", a.LocalAuthRef)
	populate(objectMap, "managedIdentity", a.ManagedIdentity)
	populate(objectMap, "sasToken", a.SasToken)
	populate(objectMap, "servicePrincipal", a.ServicePrincipal)
	populate(objectMap, "syncIntervalInSeconds", a.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", a.TimeoutInSeconds)
	populate(objectMap, "url", a.URL)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBlobDefinition.
func (a *AzureBlobDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", a, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "accountKey":
			err = unpopulate(val, "AccountKey", &a.AccountKey)
			delete(rawMsg, key)
		case "containerName":
			err = unpopulate(val, "ContainerName", &a.ContainerName)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &a.LocalAuthRef)
			delete(rawMsg, key)
		case "managedIdentity":
			err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity)
			delete(rawMsg, key)
		case "sasToken":
			err = unpopulate(val, "SasToken", &a.SasToken)
			delete(rawMsg, key)
		case "servicePrincipal":
			err = unpopulate(val, "ServicePrincipal", &a.ServicePrincipal)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &a.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &a.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &a.URL)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", a, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type AzureBlobPatchDefinition.
func (a AzureBlobPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "accountKey", a.AccountKey)
	populate(objectMap, "containerName", a.ContainerName)
	populate(objectMap, "localAuthRef", a.LocalAuthRef)
	populate(objectMap, "managedIdentity", a.ManagedIdentity)
	populate(objectMap, "sasToken", a.SasToken)
	populate(objectMap, "servicePrincipal", a.ServicePrincipal)
	populate(objectMap, "syncIntervalInSeconds", a.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", a.TimeoutInSeconds)
	populate(objectMap, "url", a.URL)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBlobPatchDefinition.
func (a *AzureBlobPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", a, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "accountKey":
			err = unpopulate(val, "AccountKey", &a.AccountKey)
			delete(rawMsg, key)
		case "containerName":
			err = unpopulate(val, "ContainerName", &a.ContainerName)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &a.LocalAuthRef)
			delete(rawMsg, key)
		case "managedIdentity":
			err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity)
			delete(rawMsg, key)
		case "sasToken":
			err = unpopulate(val, "SasToken", &a.SasToken)
			delete(rawMsg, key)
		case "servicePrincipal":
			err = unpopulate(val, "ServicePrincipal", &a.ServicePrincipal)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &a.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &a.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &a.URL)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", a, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type BucketDefinition.
func (b BucketDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "accessKey", b.AccessKey)
	populate(objectMap, "bucketName", b.BucketName)
	populate(objectMap, "insecure", b.Insecure)
	populate(objectMap, "localAuthRef", b.LocalAuthRef)
	populate(objectMap, "syncIntervalInSeconds", b.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", b.TimeoutInSeconds)
	populate(objectMap, "url", b.URL)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BucketDefinition.
func (b *BucketDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", b, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "accessKey":
			err = unpopulate(val, "AccessKey", &b.AccessKey)
			delete(rawMsg, key)
		case "bucketName":
			err = unpopulate(val, "BucketName", &b.BucketName)
			delete(rawMsg, key)
		case "insecure":
			err = unpopulate(val, "Insecure", &b.Insecure)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &b.LocalAuthRef)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &b.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &b.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &b.URL)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", b, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type BucketPatchDefinition.
func (b BucketPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "accessKey", b.AccessKey)
	populate(objectMap, "bucketName", b.BucketName)
	populate(objectMap, "insecure", b.Insecure)
	populate(objectMap, "localAuthRef", b.LocalAuthRef)
	populate(objectMap, "syncIntervalInSeconds", b.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", b.TimeoutInSeconds)
	populate(objectMap, "url", b.URL)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BucketPatchDefinition.
func (b *BucketPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", b, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "accessKey":
			err = unpopulate(val, "AccessKey", &b.AccessKey)
			delete(rawMsg, key)
		case "bucketName":
			err = unpopulate(val, "BucketName", &b.BucketName)
			delete(rawMsg, key)
		case "insecure":
			err = unpopulate(val, "Insecure", &b.Insecure)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &b.LocalAuthRef)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &b.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &b.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &b.URL)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", b, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo.
func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateAny(objectMap, "info", e.Info)
	populate(objectMap, "type", e.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo.
func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", e, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "info":
			err = unpopulate(val, "Info", &e.Info)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &e.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", e, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ErrorDetail.
func (e ErrorDetail) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "additionalInfo", e.AdditionalInfo)
	populate(objectMap, "code", e.Code)
	populate(objectMap, "details", e.Details)
	populate(objectMap, "message", e.Message)
	populate(objectMap, "target", e.Target)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail.
func (e *ErrorDetail) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", e, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "additionalInfo":
			err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo)
			delete(rawMsg, key)
		case "code":
			err = unpopulate(val, "Code", &e.Code)
			delete(rawMsg, key)
		case "details":
			err = unpopulate(val, "Details", &e.Details)
			delete(rawMsg, key)
		case "message":
			err = unpopulate(val, "Message", &e.Message)
			delete(rawMsg, key)
		case "target":
			err = unpopulate(val, "Target", &e.Target)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", e, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type FluxConfiguration.
func (f FluxConfiguration) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", f.ID)
	populate(objectMap, "name", f.Name)
	populate(objectMap, "properties", f.Properties)
	populate(objectMap, "systemData", f.SystemData)
	populate(objectMap, "type", f.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FluxConfiguration.
func (f *FluxConfiguration) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", f, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &f.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &f.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &f.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &f.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &f.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", f, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type FluxConfigurationPatch.
func (f FluxConfigurationPatch) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "properties", f.Properties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FluxConfigurationPatch.
func (f *FluxConfigurationPatch) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", f, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "properties":
			err = unpopulate(val, "Properties", &f.Properties)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", f, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type FluxConfigurationPatchProperties.
func (f FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "azureBlob", f.AzureBlob)
	populate(objectMap, "bucket", f.Bucket)
	populate(objectMap, "configurationProtectedSettings", f.ConfigurationProtectedSettings)
	populate(objectMap, "gitRepository", f.GitRepository)
	populate(objectMap, "kustomizations", f.Kustomizations)
	populate(objectMap, "ociRepository", f.OciRepository)
	populate(objectMap, "sourceKind", f.SourceKind)
	populate(objectMap, "suspend", f.Suspend)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FluxConfigurationPatchProperties.
func (f *FluxConfigurationPatchProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", f, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "azureBlob":
			err = unpopulate(val, "AzureBlob", &f.AzureBlob)
			delete(rawMsg, key)
		case "bucket":
			err = unpopulate(val, "Bucket", &f.Bucket)
			delete(rawMsg, key)
		case "configurationProtectedSettings":
			err = unpopulate(val, "ConfigurationProtectedSettings", &f.ConfigurationProtectedSettings)
			delete(rawMsg, key)
		case "gitRepository":
			err = unpopulate(val, "GitRepository", &f.GitRepository)
			delete(rawMsg, key)
		case "kustomizations":
			err = unpopulate(val, "Kustomizations", &f.Kustomizations)
			delete(rawMsg, key)
		case "ociRepository":
			err = unpopulate(val, "OciRepository", &f.OciRepository)
			delete(rawMsg, key)
		case "sourceKind":
			err = unpopulate(val, "SourceKind", &f.SourceKind)
			delete(rawMsg, key)
		case "suspend":
			err = unpopulate(val, "Suspend", &f.Suspend)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", f, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type FluxConfigurationProperties.
func (f FluxConfigurationProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "azureBlob", f.AzureBlob)
	populate(objectMap, "bucket", f.Bucket)
	populate(objectMap, "complianceState", f.ComplianceState)
	populate(objectMap, "configurationProtectedSettings", f.ConfigurationProtectedSettings)
	populate(objectMap, "errorMessage", f.ErrorMessage)
	populate(objectMap, "gitRepository", f.GitRepository)
	populate(objectMap, "kustomizations", f.Kustomizations)
	populate(objectMap, "namespace", f.Namespace)
	populate(objectMap, "ociRepository", f.OciRepository)
	populate(objectMap, "provisioningState", f.ProvisioningState)
	populate(objectMap, "reconciliationWaitDuration", f.ReconciliationWaitDuration)
	populate(objectMap, "repositoryPublicKey", f.RepositoryPublicKey)
	populate(objectMap, "scope", f.Scope)
	populate(objectMap, "sourceKind", f.SourceKind)
	populate(objectMap, "sourceSyncedCommitId", f.SourceSyncedCommitID)
	populateDateTimeRFC3339(objectMap, "sourceUpdatedAt", f.SourceUpdatedAt)
	populateDateTimeRFC3339(objectMap, "statusUpdatedAt", f.StatusUpdatedAt)
	populate(objectMap, "statuses", f.Statuses)
	populate(objectMap, "suspend", f.Suspend)
	populate(objectMap, "waitForReconciliation", f.WaitForReconciliation)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FluxConfigurationProperties.
func (f *FluxConfigurationProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", f, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "azureBlob":
			err = unpopulate(val, "AzureBlob", &f.AzureBlob)
			delete(rawMsg, key)
		case "bucket":
			err = unpopulate(val, "Bucket", &f.Bucket)
			delete(rawMsg, key)
		case "complianceState":
			err = unpopulate(val, "ComplianceState", &f.ComplianceState)
			delete(rawMsg, key)
		case "configurationProtectedSettings":
			err = unpopulate(val, "ConfigurationProtectedSettings", &f.ConfigurationProtectedSettings)
			delete(rawMsg, key)
		case "errorMessage":
			err = unpopulate(val, "ErrorMessage", &f.ErrorMessage)
			delete(rawMsg, key)
		case "gitRepository":
			err = unpopulate(val, "GitRepository", &f.GitRepository)
			delete(rawMsg, key)
		case "kustomizations":
			err = unpopulate(val, "Kustomizations", &f.Kustomizations)
			delete(rawMsg, key)
		case "namespace":
			err = unpopulate(val, "Namespace", &f.Namespace)
			delete(rawMsg, key)
		case "ociRepository":
			err = unpopulate(val, "OciRepository", &f.OciRepository)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &f.ProvisioningState)
			delete(rawMsg, key)
		case "reconciliationWaitDuration":
			err = unpopulate(val, "ReconciliationWaitDuration", &f.ReconciliationWaitDuration)
			delete(rawMsg, key)
		case "repositoryPublicKey":
			err = unpopulate(val, "RepositoryPublicKey", &f.RepositoryPublicKey)
			delete(rawMsg, key)
		case "scope":
			err = unpopulate(val, "Scope", &f.Scope)
			delete(rawMsg, key)
		case "sourceKind":
			err = unpopulate(val, "SourceKind", &f.SourceKind)
			delete(rawMsg, key)
		case "sourceSyncedCommitId":
			err = unpopulate(val, "SourceSyncedCommitID", &f.SourceSyncedCommitID)
			delete(rawMsg, key)
		case "sourceUpdatedAt":
			err = unpopulateDateTimeRFC3339(val, "SourceUpdatedAt", &f.SourceUpdatedAt)
			delete(rawMsg, key)
		case "statusUpdatedAt":
			err = unpopulateDateTimeRFC3339(val, "StatusUpdatedAt", &f.StatusUpdatedAt)
			delete(rawMsg, key)
		case "statuses":
			err = unpopulate(val, "Statuses", &f.Statuses)
			delete(rawMsg, key)
		case "suspend":
			err = unpopulate(val, "Suspend", &f.Suspend)
			delete(rawMsg, key)
		case "waitForReconciliation":
			err = unpopulate(val, "WaitForReconciliation", &f.WaitForReconciliation)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", f, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type GitRepositoryDefinition.
func (g GitRepositoryDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "httpsCACert", g.HTTPSCACert)
	populate(objectMap, "httpsUser", g.HTTPSUser)
	populate(objectMap, "localAuthRef", g.LocalAuthRef)
	populate(objectMap, "provider", g.Provider)
	populate(objectMap, "repositoryRef", g.RepositoryRef)
	populate(objectMap, "sshKnownHosts", g.SSHKnownHosts)
	populate(objectMap, "syncIntervalInSeconds", g.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", g.TimeoutInSeconds)
	populate(objectMap, "url", g.URL)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type GitRepositoryDefinition.
func (g *GitRepositoryDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", g, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "httpsCACert":
			err = unpopulate(val, "HTTPSCACert", &g.HTTPSCACert)
			delete(rawMsg, key)
		case "httpsUser":
			err = unpopulate(val, "HTTPSUser", &g.HTTPSUser)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &g.LocalAuthRef)
			delete(rawMsg, key)
		case "provider":
			err = unpopulate(val, "Provider", &g.Provider)
			delete(rawMsg, key)
		case "repositoryRef":
			err = unpopulate(val, "RepositoryRef", &g.RepositoryRef)
			delete(rawMsg, key)
		case "sshKnownHosts":
			err = unpopulate(val, "SSHKnownHosts", &g.SSHKnownHosts)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &g.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &g.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &g.URL)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", g, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type GitRepositoryPatchDefinition.
func (g GitRepositoryPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "httpsCACert", g.HTTPSCACert)
	populate(objectMap, "httpsUser", g.HTTPSUser)
	populate(objectMap, "localAuthRef", g.LocalAuthRef)
	populate(objectMap, "provider", g.Provider)
	populate(objectMap, "repositoryRef", g.RepositoryRef)
	populate(objectMap, "sshKnownHosts", g.SSHKnownHosts)
	populate(objectMap, "syncIntervalInSeconds", g.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", g.TimeoutInSeconds)
	populate(objectMap, "url", g.URL)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type GitRepositoryPatchDefinition.
func (g *GitRepositoryPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", g, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "httpsCACert":
			err = unpopulate(val, "HTTPSCACert", &g.HTTPSCACert)
			delete(rawMsg, key)
		case "httpsUser":
			err = unpopulate(val, "HTTPSUser", &g.HTTPSUser)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &g.LocalAuthRef)
			delete(rawMsg, key)
		case "provider":
			err = unpopulate(val, "Provider", &g.Provider)
			delete(rawMsg, key)
		case "repositoryRef":
			err = unpopulate(val, "RepositoryRef", &g.RepositoryRef)
			delete(rawMsg, key)
		case "sshKnownHosts":
			err = unpopulate(val, "SSHKnownHosts", &g.SSHKnownHosts)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &g.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &g.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &g.URL)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", g, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type HelmReleasePropertiesDefinition.
func (h HelmReleasePropertiesDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "failureCount", h.FailureCount)
	populate(objectMap, "helmChartRef", h.HelmChartRef)
	populate(objectMap, "installFailureCount", h.InstallFailureCount)
	populate(objectMap, "lastRevisionApplied", h.LastRevisionApplied)
	populate(objectMap, "upgradeFailureCount", h.UpgradeFailureCount)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type HelmReleasePropertiesDefinition.
func (h *HelmReleasePropertiesDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", h, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "failureCount":
			err = unpopulate(val, "FailureCount", &h.FailureCount)
			delete(rawMsg, key)
		case "helmChartRef":
			err = unpopulate(val, "HelmChartRef", &h.HelmChartRef)
			delete(rawMsg, key)
		case "installFailureCount":
			err = unpopulate(val, "InstallFailureCount", &h.InstallFailureCount)
			delete(rawMsg, key)
		case "lastRevisionApplied":
			err = unpopulate(val, "LastRevisionApplied", &h.LastRevisionApplied)
			delete(rawMsg, key)
		case "upgradeFailureCount":
			err = unpopulate(val, "UpgradeFailureCount", &h.UpgradeFailureCount)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", h, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type KustomizationDefinition.
func (k KustomizationDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "dependsOn", k.DependsOn)
	populate(objectMap, "force", k.Force)
	populate(objectMap, "name", k.Name)
	populate(objectMap, "path", k.Path)
	populate(objectMap, "postBuild", k.PostBuild)
	populate(objectMap, "prune", k.Prune)
	populate(objectMap, "retryIntervalInSeconds", k.RetryIntervalInSeconds)
	populate(objectMap, "syncIntervalInSeconds", k.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", k.TimeoutInSeconds)
	populate(objectMap, "wait", k.Wait)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type KustomizationDefinition.
func (k *KustomizationDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", k, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "dependsOn":
			err = unpopulate(val, "DependsOn", &k.DependsOn)
			delete(rawMsg, key)
		case "force":
			err = unpopulate(val, "Force", &k.Force)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &k.Name)
			delete(rawMsg, key)
		case "path":
			err = unpopulate(val, "Path", &k.Path)
			delete(rawMsg, key)
		case "postBuild":
			err = unpopulate(val, "PostBuild", &k.PostBuild)
			delete(rawMsg, key)
		case "prune":
			err = unpopulate(val, "Prune", &k.Prune)
			delete(rawMsg, key)
		case "retryIntervalInSeconds":
			err = unpopulate(val, "RetryIntervalInSeconds", &k.RetryIntervalInSeconds)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &k.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &k.TimeoutInSeconds)
			delete(rawMsg, key)
		case "wait":
			err = unpopulate(val, "Wait", &k.Wait)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", k, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type KustomizationPatchDefinition.
func (k KustomizationPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "dependsOn", k.DependsOn)
	populate(objectMap, "force", k.Force)
	populate(objectMap, "path", k.Path)
	populate(objectMap, "postBuild", k.PostBuild)
	populate(objectMap, "prune", k.Prune)
	populate(objectMap, "retryIntervalInSeconds", k.RetryIntervalInSeconds)
	populate(objectMap, "syncIntervalInSeconds", k.SyncIntervalInSeconds)
	populate(objectMap, "timeoutInSeconds", k.TimeoutInSeconds)
	populate(objectMap, "wait", k.Wait)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type KustomizationPatchDefinition.
func (k *KustomizationPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", k, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "dependsOn":
			err = unpopulate(val, "DependsOn", &k.DependsOn)
			delete(rawMsg, key)
		case "force":
			err = unpopulate(val, "Force", &k.Force)
			delete(rawMsg, key)
		case "path":
			err = unpopulate(val, "Path", &k.Path)
			delete(rawMsg, key)
		case "postBuild":
			err = unpopulate(val, "PostBuild", &k.PostBuild)
			delete(rawMsg, key)
		case "prune":
			err = unpopulate(val, "Prune", &k.Prune)
			delete(rawMsg, key)
		case "retryIntervalInSeconds":
			err = unpopulate(val, "RetryIntervalInSeconds", &k.RetryIntervalInSeconds)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &k.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &k.TimeoutInSeconds)
			delete(rawMsg, key)
		case "wait":
			err = unpopulate(val, "Wait", &k.Wait)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", k, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type LayerSelectorDefinition.
func (l LayerSelectorDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "mediaType", l.MediaType)
	populate(objectMap, "operation", l.Operation)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type LayerSelectorDefinition.
func (l *LayerSelectorDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", l, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "mediaType":
			err = unpopulate(val, "MediaType", &l.MediaType)
			delete(rawMsg, key)
		case "operation":
			err = unpopulate(val, "Operation", &l.Operation)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", l, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type LayerSelectorPatchDefinition.
func (l LayerSelectorPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "mediaType", l.MediaType)
	populate(objectMap, "operation", l.Operation)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type LayerSelectorPatchDefinition.
func (l *LayerSelectorPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", l, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "mediaType":
			err = unpopulate(val, "MediaType", &l.MediaType)
			delete(rawMsg, key)
		case "operation":
			err = unpopulate(val, "Operation", &l.Operation)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", l, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type List.
func (l List) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", l.NextLink)
	populate(objectMap, "value", l.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type List.
func (l *List) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", l, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &l.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &l.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", l, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ManagedIdentityDefinition.
func (m ManagedIdentityDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "clientId", m.ClientID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentityDefinition.
func (m *ManagedIdentityDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", m, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "clientId":
			err = unpopulate(val, "ClientID", &m.ClientID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", m, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ManagedIdentityPatchDefinition.
func (m ManagedIdentityPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "clientId", m.ClientID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentityPatchDefinition.
func (m *ManagedIdentityPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", m, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "clientId":
			err = unpopulate(val, "ClientID", &m.ClientID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", m, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type MatchOidcIdentityDefinition.
func (m MatchOidcIdentityDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "issuer", m.Issuer)
	populate(objectMap, "subject", m.Subject)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MatchOidcIdentityDefinition.
func (m *MatchOidcIdentityDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", m, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "issuer":
			err = unpopulate(val, "Issuer", &m.Issuer)
			delete(rawMsg, key)
		case "subject":
			err = unpopulate(val, "Subject", &m.Subject)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", m, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type MatchOidcIdentityPatchDefinition.
func (m MatchOidcIdentityPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "issuer", m.Issuer)
	populate(objectMap, "subject", m.Subject)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MatchOidcIdentityPatchDefinition.
func (m *MatchOidcIdentityPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", m, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "issuer":
			err = unpopulate(val, "Issuer", &m.Issuer)
			delete(rawMsg, key)
		case "subject":
			err = unpopulate(val, "Subject", &m.Subject)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", m, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryDefinition.
func (o OCIRepositoryDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "insecure", o.Insecure)
	populate(objectMap, "layerSelector", o.LayerSelector)
	populate(objectMap, "localAuthRef", o.LocalAuthRef)
	populate(objectMap, "repositoryRef", o.RepositoryRef)
	populate(objectMap, "serviceAccountName", o.ServiceAccountName)
	populate(objectMap, "syncIntervalInSeconds", o.SyncIntervalInSeconds)
	populate(objectMap, "tlsConfig", o.TLSConfig)
	populate(objectMap, "timeoutInSeconds", o.TimeoutInSeconds)
	populate(objectMap, "url", o.URL)
	populate(objectMap, "useWorkloadIdentity", o.UseWorkloadIdentity)
	populate(objectMap, "verify", o.Verify)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryDefinition.
func (o *OCIRepositoryDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "insecure":
			err = unpopulate(val, "Insecure", &o.Insecure)
			delete(rawMsg, key)
		case "layerSelector":
			err = unpopulate(val, "LayerSelector", &o.LayerSelector)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &o.LocalAuthRef)
			delete(rawMsg, key)
		case "repositoryRef":
			err = unpopulate(val, "RepositoryRef", &o.RepositoryRef)
			delete(rawMsg, key)
		case "serviceAccountName":
			err = unpopulate(val, "ServiceAccountName", &o.ServiceAccountName)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &o.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "tlsConfig":
			err = unpopulate(val, "TLSConfig", &o.TLSConfig)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &o.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &o.URL)
			delete(rawMsg, key)
		case "useWorkloadIdentity":
			err = unpopulate(val, "UseWorkloadIdentity", &o.UseWorkloadIdentity)
			delete(rawMsg, key)
		case "verify":
			err = unpopulate(val, "Verify", &o.Verify)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryPatchDefinition.
func (o OCIRepositoryPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "insecure", o.Insecure)
	populate(objectMap, "layerSelector", o.LayerSelector)
	populate(objectMap, "localAuthRef", o.LocalAuthRef)
	populate(objectMap, "repositoryRef", o.RepositoryRef)
	populate(objectMap, "serviceAccountName", o.ServiceAccountName)
	populate(objectMap, "syncIntervalInSeconds", o.SyncIntervalInSeconds)
	populate(objectMap, "tlsConfig", o.TLSConfig)
	populate(objectMap, "timeoutInSeconds", o.TimeoutInSeconds)
	populate(objectMap, "url", o.URL)
	populate(objectMap, "useWorkloadIdentity", o.UseWorkloadIdentity)
	populate(objectMap, "verify", o.Verify)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryPatchDefinition.
func (o *OCIRepositoryPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "insecure":
			err = unpopulate(val, "Insecure", &o.Insecure)
			delete(rawMsg, key)
		case "layerSelector":
			err = unpopulate(val, "LayerSelector", &o.LayerSelector)
			delete(rawMsg, key)
		case "localAuthRef":
			err = unpopulate(val, "LocalAuthRef", &o.LocalAuthRef)
			delete(rawMsg, key)
		case "repositoryRef":
			err = unpopulate(val, "RepositoryRef", &o.RepositoryRef)
			delete(rawMsg, key)
		case "serviceAccountName":
			err = unpopulate(val, "ServiceAccountName", &o.ServiceAccountName)
			delete(rawMsg, key)
		case "syncIntervalInSeconds":
			err = unpopulate(val, "SyncIntervalInSeconds", &o.SyncIntervalInSeconds)
			delete(rawMsg, key)
		case "tlsConfig":
			err = unpopulate(val, "TLSConfig", &o.TLSConfig)
			delete(rawMsg, key)
		case "timeoutInSeconds":
			err = unpopulate(val, "TimeoutInSeconds", &o.TimeoutInSeconds)
			delete(rawMsg, key)
		case "url":
			err = unpopulate(val, "URL", &o.URL)
			delete(rawMsg, key)
		case "useWorkloadIdentity":
			err = unpopulate(val, "UseWorkloadIdentity", &o.UseWorkloadIdentity)
			delete(rawMsg, key)
		case "verify":
			err = unpopulate(val, "Verify", &o.Verify)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryRefDefinition.
func (o OCIRepositoryRefDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "digest", o.Digest)
	populate(objectMap, "semver", o.Semver)
	populate(objectMap, "tag", o.Tag)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryRefDefinition.
func (o *OCIRepositoryRefDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "digest":
			err = unpopulate(val, "Digest", &o.Digest)
			delete(rawMsg, key)
		case "semver":
			err = unpopulate(val, "Semver", &o.Semver)
			delete(rawMsg, key)
		case "tag":
			err = unpopulate(val, "Tag", &o.Tag)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryRefPatchDefinition.
func (o OCIRepositoryRefPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "digest", o.Digest)
	populate(objectMap, "semver", o.Semver)
	populate(objectMap, "tag", o.Tag)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryRefPatchDefinition.
func (o *OCIRepositoryRefPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "digest":
			err = unpopulate(val, "Digest", &o.Digest)
			delete(rawMsg, key)
		case "semver":
			err = unpopulate(val, "Semver", &o.Semver)
			delete(rawMsg, key)
		case "tag":
			err = unpopulate(val, "Tag", &o.Tag)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ObjectReferenceDefinition.
func (o ObjectReferenceDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "name", o.Name)
	populate(objectMap, "namespace", o.Namespace)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectReferenceDefinition.
func (o *ObjectReferenceDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "name":
			err = unpopulate(val, "Name", &o.Name)
			delete(rawMsg, key)
		case "namespace":
			err = unpopulate(val, "Namespace", &o.Namespace)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ObjectStatusConditionDefinition.
func (o ObjectStatusConditionDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateDateTimeRFC3339(objectMap, "lastTransitionTime", o.LastTransitionTime)
	populate(objectMap, "message", o.Message)
	populate(objectMap, "reason", o.Reason)
	populate(objectMap, "status", o.Status)
	populate(objectMap, "type", o.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectStatusConditionDefinition.
func (o *ObjectStatusConditionDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "lastTransitionTime":
			err = unpopulateDateTimeRFC3339(val, "LastTransitionTime", &o.LastTransitionTime)
			delete(rawMsg, key)
		case "message":
			err = unpopulate(val, "Message", &o.Message)
			delete(rawMsg, key)
		case "reason":
			err = unpopulate(val, "Reason", &o.Reason)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &o.Status)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &o.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ObjectStatusDefinition.
func (o ObjectStatusDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedBy", o.AppliedBy)
	populate(objectMap, "complianceState", o.ComplianceState)
	populate(objectMap, "helmReleaseProperties", o.HelmReleaseProperties)
	populate(objectMap, "kind", o.Kind)
	populate(objectMap, "name", o.Name)
	populate(objectMap, "namespace", o.Namespace)
	populate(objectMap, "statusConditions", o.StatusConditions)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectStatusDefinition.
func (o *ObjectStatusDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "appliedBy":
			err = unpopulate(val, "AppliedBy", &o.AppliedBy)
			delete(rawMsg, key)
		case "complianceState":
			err = unpopulate(val, "ComplianceState", &o.ComplianceState)
			delete(rawMsg, key)
		case "helmReleaseProperties":
			err = unpopulate(val, "HelmReleaseProperties", &o.HelmReleaseProperties)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &o.Kind)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &o.Name)
			delete(rawMsg, key)
		case "namespace":
			err = unpopulate(val, "Namespace", &o.Namespace)
			delete(rawMsg, key)
		case "statusConditions":
			err = unpopulate(val, "StatusConditions", &o.StatusConditions)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult.
func (o OperationStatusResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "error", o.Error)
	populate(objectMap, "id", o.ID)
	populate(objectMap, "name", o.Name)
	populate(objectMap, "properties", o.Properties)
	populate(objectMap, "status", o.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult.
func (o *OperationStatusResult) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "error":
			err = unpopulate(val, "Error", &o.Error)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &o.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &o.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &o.Properties)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &o.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type PostBuildDefinition.
func (p PostBuildDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "substitute", p.Substitute)
	populate(objectMap, "substituteFrom", p.SubstituteFrom)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PostBuildDefinition.
func (p *PostBuildDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", p, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "substitute":
			err = unpopulate(val, "Substitute", &p.Substitute)
			delete(rawMsg, key)
		case "substituteFrom":
			err = unpopulate(val, "SubstituteFrom", &p.SubstituteFrom)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", p, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type PostBuildPatchDefinition.
func (p PostBuildPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "substitute", p.Substitute)
	populate(objectMap, "substituteFrom", p.SubstituteFrom)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PostBuildPatchDefinition.
func (p *PostBuildPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", p, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "substitute":
			err = unpopulate(val, "Substitute", &p.Substitute)
			delete(rawMsg, key)
		case "substituteFrom":
			err = unpopulate(val, "SubstituteFrom", &p.SubstituteFrom)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", p, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type RepositoryRefDefinition.
func (r RepositoryRefDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "branch", r.Branch)
	populate(objectMap, "commit", r.Commit)
	populate(objectMap, "semver", r.Semver)
	populate(objectMap, "tag", r.Tag)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type RepositoryRefDefinition.
func (r *RepositoryRefDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", r, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "branch":
			err = unpopulate(val, "Branch", &r.Branch)
			delete(rawMsg, key)
		case "commit":
			err = unpopulate(val, "Commit", &r.Commit)
			delete(rawMsg, key)
		case "semver":
			err = unpopulate(val, "Semver", &r.Semver)
			delete(rawMsg, key)
		case "tag":
			err = unpopulate(val, "Tag", &r.Tag)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", r, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ServicePrincipalDefinition.
func (s ServicePrincipalDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "clientCertificate", s.ClientCertificate)
	populate(objectMap, "clientCertificatePassword", s.ClientCertificatePassword)
	populate(objectMap, "clientCertificateSendChain", s.ClientCertificateSendChain)
	populate(objectMap, "clientId", s.ClientID)
	populate(objectMap, "clientSecret", s.ClientSecret)
	populate(objectMap, "tenantId", s.TenantID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalDefinition.
func (s *ServicePrincipalDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "clientCertificate":
			err = unpopulate(val, "ClientCertificate", &s.ClientCertificate)
			delete(rawMsg, key)
		case "clientCertificatePassword":
			err = unpopulate(val, "ClientCertificatePassword", &s.ClientCertificatePassword)
			delete(rawMsg, key)
		case "clientCertificateSendChain":
			err = unpopulate(val, "ClientCertificateSendChain", &s.ClientCertificateSendChain)
			delete(rawMsg, key)
		case "clientId":
			err = unpopulate(val, "ClientID", &s.ClientID)
			delete(rawMsg, key)
		case "clientSecret":
			err = unpopulate(val, "ClientSecret", &s.ClientSecret)
			delete(rawMsg, key)
		case "tenantId":
			err = unpopulate(val, "TenantID", &s.TenantID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ServicePrincipalPatchDefinition.
func (s ServicePrincipalPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "clientCertificate", s.ClientCertificate)
	populate(objectMap, "clientCertificatePassword", s.ClientCertificatePassword)
	populate(objectMap, "clientCertificateSendChain", s.ClientCertificateSendChain)
	populate(objectMap, "clientId", s.ClientID)
	populate(objectMap, "clientSecret", s.ClientSecret)
	populate(objectMap, "tenantId", s.TenantID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalPatchDefinition.
func (s *ServicePrincipalPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "clientCertificate":
			err = unpopulate(val, "ClientCertificate", &s.ClientCertificate)
			delete(rawMsg, key)
		case "clientCertificatePassword":
			err = unpopulate(val, "ClientCertificatePassword", &s.ClientCertificatePassword)
			delete(rawMsg, key)
		case "clientCertificateSendChain":
			err = unpopulate(val, "ClientCertificateSendChain", &s.ClientCertificateSendChain)
			delete(rawMsg, key)
		case "clientId":
			err = unpopulate(val, "ClientID", &s.ClientID)
			delete(rawMsg, key)
		case "clientSecret":
			err = unpopulate(val, "ClientSecret", &s.ClientSecret)
			delete(rawMsg, key)
		case "tenantId":
			err = unpopulate(val, "TenantID", &s.TenantID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type SubstituteFromDefinition.
func (s SubstituteFromDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "kind", s.Kind)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "optional", s.Optional)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SubstituteFromDefinition.
func (s *SubstituteFromDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "kind":
			err = unpopulate(val, "Kind", &s.Kind)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "optional":
			err = unpopulate(val, "Optional", &s.Optional)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type SubstituteFromPatchDefinition.
func (s SubstituteFromPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "kind", s.Kind)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "optional", s.Optional)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SubstituteFromPatchDefinition.
func (s *SubstituteFromPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "kind":
			err = unpopulate(val, "Kind", &s.Kind)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "optional":
			err = unpopulate(val, "Optional", &s.Optional)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type SystemData.
func (s SystemData) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt)
	populate(objectMap, "createdBy", s.CreatedBy)
	populate(objectMap, "createdByType", s.CreatedByType)
	populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt)
	populate(objectMap, "lastModifiedBy", s.LastModifiedBy)
	populate(objectMap, "lastModifiedByType", s.LastModifiedByType)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
func (s *SystemData) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "createdAt":
			err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt)
			delete(rawMsg, key)
		case "createdBy":
			err = unpopulate(val, "CreatedBy", &s.CreatedBy)
			delete(rawMsg, key)
		case "createdByType":
			err = unpopulate(val, "CreatedByType", &s.CreatedByType)
			delete(rawMsg, key)
		case "lastModifiedAt":
			err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt)
			delete(rawMsg, key)
		case "lastModifiedBy":
			err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy)
			delete(rawMsg, key)
		case "lastModifiedByType":
			err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type TLSConfigDefinition.
func (t TLSConfigDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "caCertificate", t.CaCertificate)
	populate(objectMap, "clientCertificate", t.ClientCertificate)
	populate(objectMap, "privateKey", t.PrivateKey)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type TLSConfigDefinition.
func (t *TLSConfigDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", t, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "caCertificate":
			err = unpopulate(val, "CaCertificate", &t.CaCertificate)
			delete(rawMsg, key)
		case "clientCertificate":
			err = unpopulate(val, "ClientCertificate", &t.ClientCertificate)
			delete(rawMsg, key)
		case "privateKey":
			err = unpopulate(val, "PrivateKey", &t.PrivateKey)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", t, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type TLSConfigPatchDefinition.
func (t TLSConfigPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "caCertificate", t.CaCertificate)
	populate(objectMap, "clientCertificate", t.ClientCertificate)
	populate(objectMap, "privateKey", t.PrivateKey)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type TLSConfigPatchDefinition.
func (t *TLSConfigPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", t, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "caCertificate":
			err = unpopulate(val, "CaCertificate", &t.CaCertificate)
			delete(rawMsg, key)
		case "clientCertificate":
			err = unpopulate(val, "ClientCertificate", &t.ClientCertificate)
			delete(rawMsg, key)
		case "privateKey":
			err = unpopulate(val, "PrivateKey", &t.PrivateKey)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", t, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type VerifyDefinition.
func (v VerifyDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "matchOidcIdentity", v.MatchOidcIdentity)
	populate(objectMap, "provider", v.Provider)
	populate(objectMap, "verificationConfig", v.VerificationConfig)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type VerifyDefinition.
func (v *VerifyDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", v, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "matchOidcIdentity":
			err = unpopulate(val, "MatchOidcIdentity", &v.MatchOidcIdentity)
			delete(rawMsg, key)
		case "provider":
			err = unpopulate(val, "Provider", &v.Provider)
			delete(rawMsg, key)
		case "verificationConfig":
			err = unpopulate(val, "VerificationConfig", &v.VerificationConfig)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", v, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type VerifyPatchDefinition.
func (v VerifyPatchDefinition) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "matchOidcIdentity", v.MatchOidcIdentity)
	populate(objectMap, "provider", v.Provider)
	populate(objectMap, "verificationConfig", v.VerificationConfig)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type VerifyPatchDefinition.
func (v *VerifyPatchDefinition) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", v, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "matchOidcIdentity":
			err = unpopulate(val, "MatchOidcIdentity", &v.MatchOidcIdentity)
			delete(rawMsg, key)
		case "provider":
			err = unpopulate(val, "Provider", &v.Provider)
			delete(rawMsg, key)
		case "verificationConfig":
			err = unpopulate(val, "VerificationConfig", &v.VerificationConfig)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", v, err)
		}
	}
	return nil
}

func populate(m map[string]any, k string, v any) {
	if v == nil {
		return
	} else if azcore.IsNullValue(v) {
		m[k] = nil
	} else if !reflect.ValueOf(v).IsNil() {
		m[k] = v
	}
}

func populateAny(m map[string]any, k string, v any) {
	if v == nil {
		return
	} else if azcore.IsNullValue(v) {
		m[k] = nil
	} else {
		m[k] = v
	}
}

func unpopulate(data json.RawMessage, fn string, v any) error {
	if data == nil || string(data) == "null" {
		return nil
	}
	if err := json.Unmarshal(data, v); err != nil {
		return fmt.Errorf("struct field %s: %v", fn, err)
	}
	return nil
}
