// 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 armbillingbenefits

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

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicableMacc.
func (a *ApplicableMacc) 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 "id":
			err = unpopulate(val, "ID", &a.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &a.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &a.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &a.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &a.Type)
			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 ApplicableMaccList.
func (a ApplicableMaccList) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", a.NextLink)
	populate(objectMap, "value", a.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicableMaccList.
func (a *ApplicableMaccList) 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 "nextLink":
			err = unpopulate(val, "NextLink", &a.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &a.Value)
			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 AppliedScopeProperties.
func (a AppliedScopeProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "displayName", a.DisplayName)
	populate(objectMap, "managementGroupId", a.ManagementGroupID)
	populate(objectMap, "resourceGroupId", a.ResourceGroupID)
	populate(objectMap, "subscriptionId", a.SubscriptionID)
	populate(objectMap, "tenantId", a.TenantID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type AppliedScopeProperties.
func (a *AppliedScopeProperties) 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 "displayName":
			err = unpopulate(val, "DisplayName", &a.DisplayName)
			delete(rawMsg, key)
		case "managementGroupId":
			err = unpopulate(val, "ManagementGroupID", &a.ManagementGroupID)
			delete(rawMsg, key)
		case "resourceGroupId":
			err = unpopulate(val, "ResourceGroupID", &a.ResourceGroupID)
			delete(rawMsg, key)
		case "subscriptionId":
			err = unpopulate(val, "SubscriptionID", &a.SubscriptionID)
			delete(rawMsg, key)
		case "tenantId":
			err = unpopulate(val, "TenantID", &a.TenantID)
			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 AutomaticShortfallSuppressReason.
func (a AutomaticShortfallSuppressReason) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "code", a.Code)
	populate(objectMap, "message", a.Message)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticShortfallSuppressReason.
func (a *AutomaticShortfallSuppressReason) 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 "code":
			err = unpopulate(val, "Code", &a.Code)
			delete(rawMsg, key)
		case "message":
			err = unpopulate(val, "Message", &a.Message)
			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 Award.
func (a Award) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "balanceVersion", a.BalanceVersion)
	populate(objectMap, "credit", a.Credit)
	populate(objectMap, "duration", a.Duration)
	populateTime[datetime.RFC3339](objectMap, "endAt", a.EndAt)
	populate(objectMap, "resourceId", a.ResourceID)
	populateTime[datetime.RFC3339](objectMap, "startAt", a.StartAt)
	populate(objectMap, "systemId", a.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Award.
func (a *Award) 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 "balanceVersion":
			err = unpopulate(val, "BalanceVersion", &a.BalanceVersion)
			delete(rawMsg, key)
		case "credit":
			err = unpopulate(val, "Credit", &a.Credit)
			delete(rawMsg, key)
		case "duration":
			err = unpopulate(val, "Duration", &a.Duration)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &a.EndAt)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &a.ResourceID)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &a.StartAt)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &a.SystemID)
			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 BenefitValidateModel.
func (b BenefitValidateModel) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefitType", b.BenefitType)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitValidateModel.
func (b *BenefitValidateModel) 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 "benefitType":
			err = unpopulate(val, "BenefitType", &b.BenefitType)
			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 BenefitValidateRequest.
func (b BenefitValidateRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefits", b.Benefits)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitValidateRequest.
func (b *BenefitValidateRequest) 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 "benefits":
			b.Benefits, err = unmarshalBenefitValidateModelClassificationArray(val)
			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 BenefitValidateResponse.
func (b BenefitValidateResponse) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefits", b.Benefits)
	populate(objectMap, "nextLink", b.NextLink)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitValidateResponse.
func (b *BenefitValidateResponse) 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 "benefits":
			err = unpopulate(val, "Benefits", &b.Benefits)
			delete(rawMsg, key)
		case "nextLink":
			err = unpopulate(val, "NextLink", &b.NextLink)
			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 BenefitValidateResponseProperty.
func (b BenefitValidateResponseProperty) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "reason", b.Reason)
	populate(objectMap, "reasonCode", b.ReasonCode)
	populate(objectMap, "resourceId", b.ResourceID)
	populate(objectMap, "valid", b.Valid)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitValidateResponseProperty.
func (b *BenefitValidateResponseProperty) 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 "reason":
			err = unpopulate(val, "Reason", &b.Reason)
			delete(rawMsg, key)
		case "reasonCode":
			err = unpopulate(val, "ReasonCode", &b.ReasonCode)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &b.ResourceID)
			delete(rawMsg, key)
		case "valid":
			err = unpopulate(val, "Valid", &b.Valid)
			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 BillingPlanInformation.
func (b BillingPlanInformation) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateTime[datetime.PlainDate](objectMap, "nextPaymentDueDate", b.NextPaymentDueDate)
	populate(objectMap, "pricingCurrencyTotal", b.PricingCurrencyTotal)
	populateTime[datetime.PlainDate](objectMap, "startDate", b.StartDate)
	populate(objectMap, "transactions", b.Transactions)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type BillingPlanInformation.
func (b *BillingPlanInformation) 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 "nextPaymentDueDate":
			err = unpopulateTime[datetime.PlainDate](val, "NextPaymentDueDate", &b.NextPaymentDueDate)
			delete(rawMsg, key)
		case "pricingCurrencyTotal":
			err = unpopulate(val, "PricingCurrencyTotal", &b.PricingCurrencyTotal)
			delete(rawMsg, key)
		case "startDate":
			err = unpopulateTime[datetime.PlainDate](val, "StartDate", &b.StartDate)
			delete(rawMsg, key)
		case "transactions":
			err = unpopulate(val, "Transactions", &b.Transactions)
			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 CatalogClaimsItem.
func (c CatalogClaimsItem) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "catalogClaimsItemType", c.CatalogClaimsItemType)
	populate(objectMap, "value", c.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CatalogClaimsItem.
func (c *CatalogClaimsItem) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "catalogClaimsItemType":
			err = unpopulate(val, "CatalogClaimsItemType", &c.CatalogClaimsItemType)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ChargeShortfallRequest.
func (c *ChargeShortfallRequest) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type Commitment.
func (c Commitment) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "amount", c.Amount)
	populate(objectMap, "currencyCode", c.CurrencyCode)
	populate(objectMap, "grain", c.Grain)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Commitment.
func (c *Commitment) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "amount":
			err = unpopulate(val, "Amount", &c.Amount)
			delete(rawMsg, key)
		case "currencyCode":
			err = unpopulate(val, "CurrencyCode", &c.CurrencyCode)
			delete(rawMsg, key)
		case "grain":
			err = unpopulate(val, "Grain", &c.Grain)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ConditionalCredit.
func (c ConditionalCredit) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "etag", c.Etag)
	populate(objectMap, "id", c.ID)
	populate(objectMap, "identity", c.Identity)
	populate(objectMap, "kind", c.Kind)
	populate(objectMap, "location", c.Location)
	populate(objectMap, "managedBy", c.ManagedBy)
	populate(objectMap, "name", c.Name)
	populate(objectMap, "plan", c.Plan)
	populate(objectMap, "properties", c.Properties)
	populate(objectMap, "sku", c.SKU)
	populate(objectMap, "systemData", c.SystemData)
	populate(objectMap, "tags", c.Tags)
	populate(objectMap, "type", c.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCredit.
func (c *ConditionalCredit) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "etag":
			err = unpopulate(val, "Etag", &c.Etag)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &c.ID)
			delete(rawMsg, key)
		case "identity":
			err = unpopulate(val, "Identity", &c.Identity)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &c.Kind)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &c.Location)
			delete(rawMsg, key)
		case "managedBy":
			err = unpopulate(val, "ManagedBy", &c.ManagedBy)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "plan":
			err = unpopulate(val, "Plan", &c.Plan)
			delete(rawMsg, key)
		case "properties":
			c.Properties, err = unmarshalConditionalCreditPropertiesClassification(val)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &c.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &c.SystemData)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &c.Tags)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &c.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditContributor.
func (c *ConditionalCreditContributor) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &c.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &c.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &c.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditContributorList.
func (c *ConditionalCreditContributorList) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &c.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditList.
func (c *ConditionalCreditList) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &c.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ConditionalCreditMilestone.
func (c ConditionalCreditMilestone) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "award", c.Award)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	populate(objectMap, "milestoneId", c.MilestoneID)
	populate(objectMap, "name", c.Name)
	populate(objectMap, "spendTarget", c.SpendTarget)
	populate(objectMap, "status", c.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditMilestone.
func (c *ConditionalCreditMilestone) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "award":
			err = unpopulate(val, "Award", &c.Award)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "milestoneId":
			err = unpopulate(val, "MilestoneID", &c.MilestoneID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "spendTarget":
			err = unpopulate(val, "SpendTarget", &c.SpendTarget)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &c.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditPatchRequest.
func (c *ConditionalCreditPatchRequest) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &c.Tags)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ConditionalCreditPatchRequestProperties.
func (c ConditionalCreditPatchRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "allowContributors", c.AllowContributors)
	populate(objectMap, "displayName", c.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	populate(objectMap, "milestones", c.Milestones)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditPatchRequestProperties.
func (c *ConditionalCreditPatchRequestProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "allowContributors":
			err = unpopulate(val, "AllowContributors", &c.AllowContributors)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &c.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "milestones":
			err = unpopulate(val, "Milestones", &c.Milestones)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ConditionalCreditProperties.
func (c ConditionalCreditProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefitResourceId", c.BenefitResourceID)
	populate(objectMap, "billingAccountResourceId", c.BillingAccountResourceID)
	populate(objectMap, "displayName", c.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	populate(objectMap, "entityType", c.EntityType)
	populate(objectMap, "productCode", c.ProductCode)
	populate(objectMap, "provisioningState", c.ProvisioningState)
	populate(objectMap, "resourceId", c.ResourceID)
	populateTime[datetime.RFC3339](objectMap, "startAt", c.StartAt)
	populate(objectMap, "status", c.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditProperties.
func (c *ConditionalCreditProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "benefitResourceId":
			err = unpopulate(val, "BenefitResourceID", &c.BenefitResourceID)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &c.BillingAccountResourceID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &c.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &c.EntityType)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &c.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &c.ProvisioningState)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &c.ResourceID)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &c.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &c.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionalCreditsValidateModel.
func (c *ConditionalCreditsValidateModel) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "benefitType":
			err = unpopulate(val, "BenefitType", &c.BenefitType)
			delete(rawMsg, key)
		case "properties":
			c.Properties, err = unmarshalConditionalCreditPropertiesClassification(val)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ConditionsItem.
func (c ConditionsItem) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "conditionName", c.ConditionName)
	populate(objectMap, "type", c.Type)
	populate(objectMap, "value", c.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionsItem.
func (c *ConditionsItem) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "conditionName":
			err = unpopulate(val, "ConditionName", &c.ConditionName)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &c.Type)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type Contributor.
func (c *Contributor) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &c.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &c.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &c.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ContributorConditionalCreditMilestone.
func (c ContributorConditionalCreditMilestone) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "award", c.Award)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	populate(objectMap, "milestoneId", c.MilestoneID)
	populate(objectMap, "name", c.Name)
	populate(objectMap, "spendTarget", c.SpendTarget)
	populate(objectMap, "status", c.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ContributorConditionalCreditMilestone.
func (c *ContributorConditionalCreditMilestone) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "award":
			err = unpopulate(val, "Award", &c.Award)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "milestoneId":
			err = unpopulate(val, "MilestoneID", &c.MilestoneID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "spendTarget":
			err = unpopulate(val, "SpendTarget", &c.SpendTarget)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &c.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ContributorConditionalCreditProperties.
func (c ContributorConditionalCreditProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefitResourceId", c.BenefitResourceID)
	populate(objectMap, "billingAccountResourceId", c.BillingAccountResourceID)
	populate(objectMap, "displayName", c.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	objectMap["entityType"] = ConditionalCreditEntityTypeContributor
	populate(objectMap, "milestones", c.Milestones)
	populate(objectMap, "primaryBillingAccountResourceId", c.PrimaryBillingAccountResourceID)
	populate(objectMap, "primaryResourceId", c.PrimaryResourceID)
	populate(objectMap, "productCode", c.ProductCode)
	populate(objectMap, "provisioningState", c.ProvisioningState)
	populate(objectMap, "resourceId", c.ResourceID)
	populateTime[datetime.RFC3339](objectMap, "startAt", c.StartAt)
	populate(objectMap, "status", c.Status)
	populate(objectMap, "systemId", c.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ContributorConditionalCreditProperties.
func (c *ContributorConditionalCreditProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "benefitResourceId":
			err = unpopulate(val, "BenefitResourceID", &c.BenefitResourceID)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &c.BillingAccountResourceID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &c.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &c.EntityType)
			delete(rawMsg, key)
		case "milestones":
			err = unpopulate(val, "Milestones", &c.Milestones)
			delete(rawMsg, key)
		case "primaryBillingAccountResourceId":
			err = unpopulate(val, "PrimaryBillingAccountResourceID", &c.PrimaryBillingAccountResourceID)
			delete(rawMsg, key)
		case "primaryResourceId":
			err = unpopulate(val, "PrimaryResourceID", &c.PrimaryResourceID)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &c.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &c.ProvisioningState)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &c.ResourceID)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &c.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &c.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &c.SystemID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type ContributorList.
func (c *ContributorList) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &c.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type Credit.
func (c Credit) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "etag", c.Etag)
	populate(objectMap, "id", c.ID)
	populate(objectMap, "identity", c.Identity)
	populate(objectMap, "kind", c.Kind)
	populate(objectMap, "location", c.Location)
	populate(objectMap, "managedBy", c.ManagedBy)
	populate(objectMap, "name", c.Name)
	populate(objectMap, "plan", c.Plan)
	populate(objectMap, "properties", c.Properties)
	populate(objectMap, "sku", c.SKU)
	populate(objectMap, "systemData", c.SystemData)
	populate(objectMap, "tags", c.Tags)
	populate(objectMap, "type", c.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Credit.
func (c *Credit) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "etag":
			err = unpopulate(val, "Etag", &c.Etag)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &c.ID)
			delete(rawMsg, key)
		case "identity":
			err = unpopulate(val, "Identity", &c.Identity)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &c.Kind)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &c.Location)
			delete(rawMsg, key)
		case "managedBy":
			err = unpopulate(val, "ManagedBy", &c.ManagedBy)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "plan":
			err = unpopulate(val, "Plan", &c.Plan)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &c.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &c.SystemData)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &c.Tags)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &c.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditBreakdownItem.
func (c CreditBreakdownItem) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "allocation", c.Allocation)
	populate(objectMap, "dimensions", c.Dimensions)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	populateTime[datetime.RFC3339](objectMap, "startAt", c.StartAt)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditBreakdownItem.
func (c *CreditBreakdownItem) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "allocation":
			err = unpopulate(val, "Allocation", &c.Allocation)
			delete(rawMsg, key)
		case "dimensions":
			err = unpopulate(val, "Dimensions", &c.Dimensions)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &c.StartAt)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditDimension.
func (c *CreditDimension) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "key":
			err = unpopulate(val, "Key", &c.Key)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditPatchProperties.
func (c CreditPatchProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "breakdown", c.Breakdown)
	populate(objectMap, "credit", c.Credit)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditPatchProperties.
func (c *CreditPatchProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "breakdown":
			err = unpopulate(val, "Breakdown", &c.Breakdown)
			delete(rawMsg, key)
		case "credit":
			err = unpopulate(val, "Credit", &c.Credit)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditPatchRequest.
func (c *CreditPatchRequest) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &c.Tags)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditPolicies.
func (c CreditPolicies) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "expiration", c.Expiration)
	populate(objectMap, "redemption", c.Redemption)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditPolicies.
func (c *CreditPolicies) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "expiration":
			err = unpopulate(val, "Expiration", &c.Expiration)
			delete(rawMsg, key)
		case "redemption":
			err = unpopulate(val, "Redemption", &c.Redemption)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditProperties.
func (c CreditProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "billingAccountResourceId", c.BillingAccountResourceID)
	populate(objectMap, "billingProfileResourceId", c.BillingProfileResourceID)
	populate(objectMap, "breakdown", c.Breakdown)
	populate(objectMap, "credit", c.Credit)
	populate(objectMap, "customerId", c.CustomerID)
	populateTime[datetime.RFC3339](objectMap, "endAt", c.EndAt)
	populate(objectMap, "policies", c.Policies)
	populate(objectMap, "productCode", c.ProductCode)
	populate(objectMap, "provisioningState", c.ProvisioningState)
	populate(objectMap, "reason", c.Reason)
	populate(objectMap, "resourceId", c.ResourceID)
	populateTime[datetime.RFC3339](objectMap, "startAt", c.StartAt)
	populate(objectMap, "status", c.Status)
	populate(objectMap, "systemId", c.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditProperties.
func (c *CreditProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &c.BillingAccountResourceID)
			delete(rawMsg, key)
		case "billingProfileResourceId":
			err = unpopulate(val, "BillingProfileResourceID", &c.BillingProfileResourceID)
			delete(rawMsg, key)
		case "breakdown":
			err = unpopulate(val, "Breakdown", &c.Breakdown)
			delete(rawMsg, key)
		case "credit":
			err = unpopulate(val, "Credit", &c.Credit)
			delete(rawMsg, key)
		case "customerId":
			err = unpopulate(val, "CustomerID", &c.CustomerID)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &c.EndAt)
			delete(rawMsg, key)
		case "policies":
			err = unpopulate(val, "Policies", &c.Policies)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &c.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &c.ProvisioningState)
			delete(rawMsg, key)
		case "reason":
			err = unpopulate(val, "Reason", &c.Reason)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &c.ResourceID)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &c.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &c.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &c.SystemID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditReason.
func (c CreditReason) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "code", c.Code)
	populate(objectMap, "description", c.Description)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditReason.
func (c *CreditReason) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "code":
			err = unpopulate(val, "Code", &c.Code)
			delete(rawMsg, key)
		case "description":
			err = unpopulate(val, "Description", &c.Description)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditSource.
func (c CreditSource) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "etag", c.Etag)
	populate(objectMap, "id", c.ID)
	populate(objectMap, "identity", c.Identity)
	populate(objectMap, "kind", c.Kind)
	populate(objectMap, "location", c.Location)
	populate(objectMap, "managedBy", c.ManagedBy)
	populate(objectMap, "name", c.Name)
	populate(objectMap, "plan", c.Plan)
	populate(objectMap, "properties", c.Properties)
	populate(objectMap, "sku", c.SKU)
	populate(objectMap, "systemData", c.SystemData)
	populate(objectMap, "tags", c.Tags)
	populate(objectMap, "type", c.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditSource.
func (c *CreditSource) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "etag":
			err = unpopulate(val, "Etag", &c.Etag)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &c.ID)
			delete(rawMsg, key)
		case "identity":
			err = unpopulate(val, "Identity", &c.Identity)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &c.Kind)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &c.Location)
			delete(rawMsg, key)
		case "managedBy":
			err = unpopulate(val, "ManagedBy", &c.ManagedBy)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &c.Name)
			delete(rawMsg, key)
		case "plan":
			err = unpopulate(val, "Plan", &c.Plan)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &c.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &c.SystemData)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &c.Tags)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &c.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditSourcePatchRequest.
func (c CreditSourcePatchRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "tags", c.Tags)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditSourcePatchRequest.
func (c *CreditSourcePatchRequest) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "tags":
			err = unpopulate(val, "Tags", &c.Tags)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CreditSourceProperties.
func (c CreditSourceProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "credit", c.Credit)
	populate(objectMap, "impactedBillingPeriod", c.ImpactedBillingPeriod)
	populate(objectMap, "sourceResourceId", c.SourceResourceID)
	populate(objectMap, "status", c.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditSourceProperties.
func (c *CreditSourceProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "credit":
			err = unpopulate(val, "Credit", &c.Credit)
			delete(rawMsg, key)
		case "impactedBillingPeriod":
			err = unpopulate(val, "ImpactedBillingPeriod", &c.ImpactedBillingPeriod)
			delete(rawMsg, key)
		case "sourceResourceId":
			err = unpopulate(val, "SourceResourceID", &c.SourceResourceID)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &c.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditSourcesList.
func (c *CreditSourcesList) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &c.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditsList.
func (c *CreditsList) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &c.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &c.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type CreditsValidateModel.
func (c *CreditsValidateModel) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "benefitType":
			err = unpopulate(val, "BenefitType", &c.BenefitType)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &c.Properties)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type CustomPriceProperties.
func (c CustomPriceProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "billingPeriod", c.BillingPeriod)
	populate(objectMap, "catalogClaims", c.CatalogClaims)
	populate(objectMap, "catalogId", c.CatalogID)
	populate(objectMap, "marketSetPrices", c.MarketSetPrices)
	populate(objectMap, "meterType", c.MeterType)
	populate(objectMap, "ruleType", c.RuleType)
	populate(objectMap, "termUnits", c.TermUnits)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type CustomPriceProperties.
func (c *CustomPriceProperties) 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", c, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "billingPeriod":
			err = unpopulate(val, "BillingPeriod", &c.BillingPeriod)
			delete(rawMsg, key)
		case "catalogClaims":
			err = unpopulate(val, "CatalogClaims", &c.CatalogClaims)
			delete(rawMsg, key)
		case "catalogId":
			err = unpopulate(val, "CatalogID", &c.CatalogID)
			delete(rawMsg, key)
		case "marketSetPrices":
			err = unpopulate(val, "MarketSetPrices", &c.MarketSetPrices)
			delete(rawMsg, key)
		case "meterType":
			err = unpopulate(val, "MeterType", &c.MeterType)
			delete(rawMsg, key)
		case "ruleType":
			err = unpopulate(val, "RuleType", &c.RuleType)
			delete(rawMsg, key)
		case "termUnits":
			err = unpopulate(val, "TermUnits", &c.TermUnits)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", c, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type Discount.
func (d Discount) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "etag", d.Etag)
	populate(objectMap, "id", d.ID)
	populate(objectMap, "identity", d.Identity)
	populate(objectMap, "kind", d.Kind)
	populate(objectMap, "location", d.Location)
	populate(objectMap, "managedBy", d.ManagedBy)
	populate(objectMap, "name", d.Name)
	populate(objectMap, "plan", d.Plan)
	populate(objectMap, "properties", d.Properties)
	populate(objectMap, "sku", d.SKU)
	populate(objectMap, "systemData", d.SystemData)
	populate(objectMap, "tags", d.Tags)
	populate(objectMap, "type", d.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Discount.
func (d *Discount) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "etag":
			err = unpopulate(val, "Etag", &d.Etag)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &d.ID)
			delete(rawMsg, key)
		case "identity":
			err = unpopulate(val, "Identity", &d.Identity)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &d.Kind)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &d.Location)
			delete(rawMsg, key)
		case "managedBy":
			err = unpopulate(val, "ManagedBy", &d.ManagedBy)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &d.Name)
			delete(rawMsg, key)
		case "plan":
			err = unpopulate(val, "Plan", &d.Plan)
			delete(rawMsg, key)
		case "properties":
			d.Properties, err = unmarshalDiscountPropertiesClassification(val)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &d.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &d.SystemData)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &d.Tags)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &d.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountList.
func (d *DiscountList) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &d.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &d.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

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

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountPatchRequest.
func (d *DiscountPatchRequest) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "properties":
			err = unpopulate(val, "Properties", &d.Properties)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &d.Tags)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountPatchRequestProperties.
func (d DiscountPatchRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "displayName", d.DisplayName)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountPatchRequestProperties.
func (d *DiscountPatchRequestProperties) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "displayName":
			err = unpopulate(val, "DisplayName", &d.DisplayName)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountProperties.
func (d DiscountProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeType", d.AppliedScopeType)
	populate(objectMap, "benefitResourceId", d.BenefitResourceID)
	populate(objectMap, "billingAccountResourceId", d.BillingAccountResourceID)
	populate(objectMap, "billingProfileResourceId", d.BillingProfileResourceID)
	populate(objectMap, "customerResourceId", d.CustomerResourceID)
	populate(objectMap, "displayName", d.DisplayName)
	populate(objectMap, "entityType", d.EntityType)
	populate(objectMap, "productCode", d.ProductCode)
	populate(objectMap, "provisioningState", d.ProvisioningState)
	populateTime[datetime.RFC3339](objectMap, "startAt", d.StartAt)
	populate(objectMap, "status", d.Status)
	populate(objectMap, "systemId", d.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountProperties.
func (d *DiscountProperties) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &d.AppliedScopeType)
			delete(rawMsg, key)
		case "benefitResourceId":
			err = unpopulate(val, "BenefitResourceID", &d.BenefitResourceID)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &d.BillingAccountResourceID)
			delete(rawMsg, key)
		case "billingProfileResourceId":
			err = unpopulate(val, "BillingProfileResourceID", &d.BillingProfileResourceID)
			delete(rawMsg, key)
		case "customerResourceId":
			err = unpopulate(val, "CustomerResourceID", &d.CustomerResourceID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &d.DisplayName)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &d.EntityType)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &d.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &d.ProvisioningState)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &d.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &d.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &d.SystemID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountTypeCustomPrice.
func (d DiscountTypeCustomPrice) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "applyDiscountOn", d.ApplyDiscountOn)
	populate(objectMap, "conditions", d.Conditions)
	populate(objectMap, "customPriceProperties", d.CustomPriceProperties)
	populate(objectMap, "discountCombinationRule", d.DiscountCombinationRule)
	populate(objectMap, "discountPercentage", d.DiscountPercentage)
	objectMap["discountType"] = DiscountTypeEnumCustomPrice
	populate(objectMap, "priceGuaranteeProperties", d.PriceGuaranteeProperties)
	populate(objectMap, "productFamilyName", d.ProductFamilyName)
	populate(objectMap, "productId", d.ProductID)
	populate(objectMap, "skuId", d.SKUID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountTypeCustomPrice.
func (d *DiscountTypeCustomPrice) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "applyDiscountOn":
			err = unpopulate(val, "ApplyDiscountOn", &d.ApplyDiscountOn)
			delete(rawMsg, key)
		case "conditions":
			err = unpopulate(val, "Conditions", &d.Conditions)
			delete(rawMsg, key)
		case "customPriceProperties":
			err = unpopulate(val, "CustomPriceProperties", &d.CustomPriceProperties)
			delete(rawMsg, key)
		case "discountCombinationRule":
			err = unpopulate(val, "DiscountCombinationRule", &d.DiscountCombinationRule)
			delete(rawMsg, key)
		case "discountPercentage":
			err = unpopulate(val, "DiscountPercentage", &d.DiscountPercentage)
			delete(rawMsg, key)
		case "discountType":
			err = unpopulate(val, "DiscountType", &d.DiscountType)
			delete(rawMsg, key)
		case "priceGuaranteeProperties":
			err = unpopulate(val, "PriceGuaranteeProperties", &d.PriceGuaranteeProperties)
			delete(rawMsg, key)
		case "productFamilyName":
			err = unpopulate(val, "ProductFamilyName", &d.ProductFamilyName)
			delete(rawMsg, key)
		case "productId":
			err = unpopulate(val, "ProductID", &d.ProductID)
			delete(rawMsg, key)
		case "skuId":
			err = unpopulate(val, "SKUID", &d.SKUID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountTypeCustomPriceMultiCurrency.
func (d DiscountTypeCustomPriceMultiCurrency) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "applyDiscountOn", d.ApplyDiscountOn)
	populate(objectMap, "conditions", d.Conditions)
	populate(objectMap, "customPriceProperties", d.CustomPriceProperties)
	populate(objectMap, "discountCombinationRule", d.DiscountCombinationRule)
	populate(objectMap, "discountPercentage", d.DiscountPercentage)
	objectMap["discountType"] = DiscountTypeEnumCustomPriceMultiCurrency
	populate(objectMap, "priceGuaranteeProperties", d.PriceGuaranteeProperties)
	populate(objectMap, "productFamilyName", d.ProductFamilyName)
	populate(objectMap, "productId", d.ProductID)
	populate(objectMap, "skuId", d.SKUID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountTypeCustomPriceMultiCurrency.
func (d *DiscountTypeCustomPriceMultiCurrency) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "applyDiscountOn":
			err = unpopulate(val, "ApplyDiscountOn", &d.ApplyDiscountOn)
			delete(rawMsg, key)
		case "conditions":
			err = unpopulate(val, "Conditions", &d.Conditions)
			delete(rawMsg, key)
		case "customPriceProperties":
			err = unpopulate(val, "CustomPriceProperties", &d.CustomPriceProperties)
			delete(rawMsg, key)
		case "discountCombinationRule":
			err = unpopulate(val, "DiscountCombinationRule", &d.DiscountCombinationRule)
			delete(rawMsg, key)
		case "discountPercentage":
			err = unpopulate(val, "DiscountPercentage", &d.DiscountPercentage)
			delete(rawMsg, key)
		case "discountType":
			err = unpopulate(val, "DiscountType", &d.DiscountType)
			delete(rawMsg, key)
		case "priceGuaranteeProperties":
			err = unpopulate(val, "PriceGuaranteeProperties", &d.PriceGuaranteeProperties)
			delete(rawMsg, key)
		case "productFamilyName":
			err = unpopulate(val, "ProductFamilyName", &d.ProductFamilyName)
			delete(rawMsg, key)
		case "productId":
			err = unpopulate(val, "ProductID", &d.ProductID)
			delete(rawMsg, key)
		case "skuId":
			err = unpopulate(val, "SKUID", &d.SKUID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountTypeProduct.
func (d DiscountTypeProduct) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "applyDiscountOn", d.ApplyDiscountOn)
	populate(objectMap, "conditions", d.Conditions)
	populate(objectMap, "discountCombinationRule", d.DiscountCombinationRule)
	populate(objectMap, "discountPercentage", d.DiscountPercentage)
	objectMap["discountType"] = DiscountTypeEnumProduct
	populate(objectMap, "priceGuaranteeProperties", d.PriceGuaranteeProperties)
	populate(objectMap, "productFamilyName", d.ProductFamilyName)
	populate(objectMap, "productId", d.ProductID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountTypeProduct.
func (d *DiscountTypeProduct) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "applyDiscountOn":
			err = unpopulate(val, "ApplyDiscountOn", &d.ApplyDiscountOn)
			delete(rawMsg, key)
		case "conditions":
			err = unpopulate(val, "Conditions", &d.Conditions)
			delete(rawMsg, key)
		case "discountCombinationRule":
			err = unpopulate(val, "DiscountCombinationRule", &d.DiscountCombinationRule)
			delete(rawMsg, key)
		case "discountPercentage":
			err = unpopulate(val, "DiscountPercentage", &d.DiscountPercentage)
			delete(rawMsg, key)
		case "discountType":
			err = unpopulate(val, "DiscountType", &d.DiscountType)
			delete(rawMsg, key)
		case "priceGuaranteeProperties":
			err = unpopulate(val, "PriceGuaranteeProperties", &d.PriceGuaranteeProperties)
			delete(rawMsg, key)
		case "productFamilyName":
			err = unpopulate(val, "ProductFamilyName", &d.ProductFamilyName)
			delete(rawMsg, key)
		case "productId":
			err = unpopulate(val, "ProductID", &d.ProductID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountTypeProductFamily.
func (d DiscountTypeProductFamily) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "applyDiscountOn", d.ApplyDiscountOn)
	populate(objectMap, "conditions", d.Conditions)
	populate(objectMap, "discountCombinationRule", d.DiscountCombinationRule)
	populate(objectMap, "discountPercentage", d.DiscountPercentage)
	objectMap["discountType"] = DiscountTypeEnumProductFamily
	populate(objectMap, "priceGuaranteeProperties", d.PriceGuaranteeProperties)
	populate(objectMap, "productFamilyName", d.ProductFamilyName)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountTypeProductFamily.
func (d *DiscountTypeProductFamily) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "applyDiscountOn":
			err = unpopulate(val, "ApplyDiscountOn", &d.ApplyDiscountOn)
			delete(rawMsg, key)
		case "conditions":
			err = unpopulate(val, "Conditions", &d.Conditions)
			delete(rawMsg, key)
		case "discountCombinationRule":
			err = unpopulate(val, "DiscountCombinationRule", &d.DiscountCombinationRule)
			delete(rawMsg, key)
		case "discountPercentage":
			err = unpopulate(val, "DiscountPercentage", &d.DiscountPercentage)
			delete(rawMsg, key)
		case "discountType":
			err = unpopulate(val, "DiscountType", &d.DiscountType)
			delete(rawMsg, key)
		case "priceGuaranteeProperties":
			err = unpopulate(val, "PriceGuaranteeProperties", &d.PriceGuaranteeProperties)
			delete(rawMsg, key)
		case "productFamilyName":
			err = unpopulate(val, "ProductFamilyName", &d.ProductFamilyName)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountTypeProductSKU.
func (d DiscountTypeProductSKU) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "applyDiscountOn", d.ApplyDiscountOn)
	populate(objectMap, "conditions", d.Conditions)
	populate(objectMap, "discountCombinationRule", d.DiscountCombinationRule)
	populate(objectMap, "discountPercentage", d.DiscountPercentage)
	objectMap["discountType"] = DiscountTypeEnumSKU
	populate(objectMap, "priceGuaranteeProperties", d.PriceGuaranteeProperties)
	populate(objectMap, "productFamilyName", d.ProductFamilyName)
	populate(objectMap, "productId", d.ProductID)
	populate(objectMap, "skuId", d.SKUID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountTypeProductSKU.
func (d *DiscountTypeProductSKU) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "applyDiscountOn":
			err = unpopulate(val, "ApplyDiscountOn", &d.ApplyDiscountOn)
			delete(rawMsg, key)
		case "conditions":
			err = unpopulate(val, "Conditions", &d.Conditions)
			delete(rawMsg, key)
		case "discountCombinationRule":
			err = unpopulate(val, "DiscountCombinationRule", &d.DiscountCombinationRule)
			delete(rawMsg, key)
		case "discountPercentage":
			err = unpopulate(val, "DiscountPercentage", &d.DiscountPercentage)
			delete(rawMsg, key)
		case "discountType":
			err = unpopulate(val, "DiscountType", &d.DiscountType)
			delete(rawMsg, key)
		case "priceGuaranteeProperties":
			err = unpopulate(val, "PriceGuaranteeProperties", &d.PriceGuaranteeProperties)
			delete(rawMsg, key)
		case "productFamilyName":
			err = unpopulate(val, "ProductFamilyName", &d.ProductFamilyName)
			delete(rawMsg, key)
		case "productId":
			err = unpopulate(val, "ProductID", &d.ProductID)
			delete(rawMsg, key)
		case "skuId":
			err = unpopulate(val, "SKUID", &d.SKUID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type DiscountTypeProperties.
func (d DiscountTypeProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "applyDiscountOn", d.ApplyDiscountOn)
	populate(objectMap, "conditions", d.Conditions)
	populate(objectMap, "discountCombinationRule", d.DiscountCombinationRule)
	populate(objectMap, "discountPercentage", d.DiscountPercentage)
	populate(objectMap, "discountType", d.DiscountType)
	populate(objectMap, "priceGuaranteeProperties", d.PriceGuaranteeProperties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type DiscountTypeProperties.
func (d *DiscountTypeProperties) 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", d, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "applyDiscountOn":
			err = unpopulate(val, "ApplyDiscountOn", &d.ApplyDiscountOn)
			delete(rawMsg, key)
		case "conditions":
			err = unpopulate(val, "Conditions", &d.Conditions)
			delete(rawMsg, key)
		case "discountCombinationRule":
			err = unpopulate(val, "DiscountCombinationRule", &d.DiscountCombinationRule)
			delete(rawMsg, key)
		case "discountPercentage":
			err = unpopulate(val, "DiscountPercentage", &d.DiscountPercentage)
			delete(rawMsg, key)
		case "discountType":
			err = unpopulate(val, "DiscountType", &d.DiscountType)
			delete(rawMsg, key)
		case "priceGuaranteeProperties":
			err = unpopulate(val, "PriceGuaranteeProperties", &d.PriceGuaranteeProperties)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", d, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type EntityTypeAffiliateDiscount.
func (e EntityTypeAffiliateDiscount) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeType", e.AppliedScopeType)
	populate(objectMap, "benefitResourceId", e.BenefitResourceID)
	populate(objectMap, "billingAccountResourceId", e.BillingAccountResourceID)
	populate(objectMap, "billingProfileResourceId", e.BillingProfileResourceID)
	populate(objectMap, "customerResourceId", e.CustomerResourceID)
	populate(objectMap, "displayName", e.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", e.EndAt)
	objectMap["entityType"] = DiscountEntityTypeAffiliate
	populate(objectMap, "primaryResourceId", e.PrimaryResourceID)
	populate(objectMap, "productCode", e.ProductCode)
	populate(objectMap, "provisioningState", e.ProvisioningState)
	populateTime[datetime.RFC3339](objectMap, "startAt", e.StartAt)
	populate(objectMap, "status", e.Status)
	populate(objectMap, "systemId", e.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTypeAffiliateDiscount.
func (e *EntityTypeAffiliateDiscount) 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 "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &e.AppliedScopeType)
			delete(rawMsg, key)
		case "benefitResourceId":
			err = unpopulate(val, "BenefitResourceID", &e.BenefitResourceID)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &e.BillingAccountResourceID)
			delete(rawMsg, key)
		case "billingProfileResourceId":
			err = unpopulate(val, "BillingProfileResourceID", &e.BillingProfileResourceID)
			delete(rawMsg, key)
		case "customerResourceId":
			err = unpopulate(val, "CustomerResourceID", &e.CustomerResourceID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &e.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &e.EndAt)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &e.EntityType)
			delete(rawMsg, key)
		case "primaryResourceId":
			err = unpopulate(val, "PrimaryResourceID", &e.PrimaryResourceID)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &e.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &e.ProvisioningState)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &e.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &e.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &e.SystemID)
			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 EntityTypePrimaryDiscount.
func (e EntityTypePrimaryDiscount) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeType", e.AppliedScopeType)
	populate(objectMap, "benefitResourceId", e.BenefitResourceID)
	populate(objectMap, "billingAccountResourceId", e.BillingAccountResourceID)
	populate(objectMap, "billingProfileResourceId", e.BillingProfileResourceID)
	populate(objectMap, "customerResourceId", e.CustomerResourceID)
	populate(objectMap, "discountTypeProperties", e.DiscountTypeProperties)
	populate(objectMap, "displayName", e.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", e.EndAt)
	objectMap["entityType"] = DiscountEntityTypePrimary
	populate(objectMap, "productCode", e.ProductCode)
	populate(objectMap, "provisioningState", e.ProvisioningState)
	populateTime[datetime.RFC3339](objectMap, "startAt", e.StartAt)
	populate(objectMap, "status", e.Status)
	populate(objectMap, "systemId", e.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTypePrimaryDiscount.
func (e *EntityTypePrimaryDiscount) 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 "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &e.AppliedScopeType)
			delete(rawMsg, key)
		case "benefitResourceId":
			err = unpopulate(val, "BenefitResourceID", &e.BenefitResourceID)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &e.BillingAccountResourceID)
			delete(rawMsg, key)
		case "billingProfileResourceId":
			err = unpopulate(val, "BillingProfileResourceID", &e.BillingProfileResourceID)
			delete(rawMsg, key)
		case "customerResourceId":
			err = unpopulate(val, "CustomerResourceID", &e.CustomerResourceID)
			delete(rawMsg, key)
		case "discountTypeProperties":
			e.DiscountTypeProperties, err = unmarshalDiscountTypePropertiesClassification(val)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &e.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &e.EndAt)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &e.EntityType)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &e.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &e.ProvisioningState)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &e.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &e.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &e.SystemID)
			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 ExtendedStatusInfo.
func (e ExtendedStatusInfo) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "message", e.Message)
	populate(objectMap, "statusCode", e.StatusCode)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedStatusInfo.
func (e *ExtendedStatusInfo) 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 "message":
			err = unpopulate(val, "Message", &e.Message)
			delete(rawMsg, key)
		case "statusCode":
			err = unpopulate(val, "StatusCode", &e.StatusCode)
			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 FreeServices.
func (f FreeServices) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "etag", f.Etag)
	populate(objectMap, "id", f.ID)
	populate(objectMap, "identity", f.Identity)
	populate(objectMap, "kind", f.Kind)
	populate(objectMap, "location", f.Location)
	populate(objectMap, "managedBy", f.ManagedBy)
	populate(objectMap, "name", f.Name)
	populate(objectMap, "plan", f.Plan)
	populate(objectMap, "properties", f.Properties)
	populate(objectMap, "sku", f.SKU)
	populate(objectMap, "systemData", f.SystemData)
	populate(objectMap, "tags", f.Tags)
	populate(objectMap, "type", f.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FreeServices.
func (f *FreeServices) 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 "etag":
			err = unpopulate(val, "Etag", &f.Etag)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &f.ID)
			delete(rawMsg, key)
		case "identity":
			err = unpopulate(val, "Identity", &f.Identity)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &f.Kind)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &f.Location)
			delete(rawMsg, key)
		case "managedBy":
			err = unpopulate(val, "ManagedBy", &f.ManagedBy)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &f.Name)
			delete(rawMsg, key)
		case "plan":
			err = unpopulate(val, "Plan", &f.Plan)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &f.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &f.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &f.SystemData)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &f.Tags)
			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 FreeServicesList.
func (f FreeServicesList) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", f.NextLink)
	populate(objectMap, "value", f.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FreeServicesList.
func (f *FreeServicesList) 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 "nextLink":
			err = unpopulate(val, "NextLink", &f.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &f.Value)
			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 FreeServicesPatchRequest.
func (f FreeServicesPatchRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "properties", f.Properties)
	populate(objectMap, "tags", f.Tags)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FreeServicesPatchRequest.
func (f *FreeServicesPatchRequest) 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)
		case "tags":
			err = unpopulate(val, "Tags", &f.Tags)
			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 FreeServicesPatchRequestProperties.
func (f FreeServicesPatchRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateTime[datetime.RFC3339](objectMap, "endAt", f.EndAt)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FreeServicesPatchRequestProperties.
func (f *FreeServicesPatchRequestProperties) 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 "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &f.EndAt)
			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 FreeServicesProperties.
func (f FreeServicesProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "billingAccountResourceId", f.BillingAccountResourceID)
	populate(objectMap, "billingProfileResourceId", f.BillingProfileResourceID)
	populate(objectMap, "customerResourceId", f.CustomerResourceID)
	populateTime[datetime.RFC3339](objectMap, "endAt", f.EndAt)
	populate(objectMap, "productCode", f.ProductCode)
	populate(objectMap, "provisioningState", f.ProvisioningState)
	populateTime[datetime.RFC3339](objectMap, "startAt", f.StartAt)
	populate(objectMap, "status", f.Status)
	populate(objectMap, "systemId", f.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type FreeServicesProperties.
func (f *FreeServicesProperties) 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 "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &f.BillingAccountResourceID)
			delete(rawMsg, key)
		case "billingProfileResourceId":
			err = unpopulate(val, "BillingProfileResourceID", &f.BillingProfileResourceID)
			delete(rawMsg, key)
		case "customerResourceId":
			err = unpopulate(val, "CustomerResourceID", &f.CustomerResourceID)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &f.EndAt)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &f.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &f.ProvisioningState)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &f.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &f.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &f.SystemID)
			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 Macc.
func (m Macc) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "etag", m.Etag)
	populate(objectMap, "id", m.ID)
	populate(objectMap, "identity", m.Identity)
	populate(objectMap, "kind", m.Kind)
	populate(objectMap, "location", m.Location)
	populate(objectMap, "managedBy", m.ManagedBy)
	populate(objectMap, "name", m.Name)
	populate(objectMap, "plan", m.Plan)
	populate(objectMap, "properties", m.Properties)
	populate(objectMap, "sku", m.SKU)
	populate(objectMap, "systemData", m.SystemData)
	populate(objectMap, "tags", m.Tags)
	populate(objectMap, "type", m.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Macc.
func (m *Macc) 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 "etag":
			err = unpopulate(val, "Etag", &m.Etag)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &m.ID)
			delete(rawMsg, key)
		case "identity":
			err = unpopulate(val, "Identity", &m.Identity)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &m.Kind)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &m.Location)
			delete(rawMsg, key)
		case "managedBy":
			err = unpopulate(val, "ManagedBy", &m.ManagedBy)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &m.Name)
			delete(rawMsg, key)
		case "plan":
			err = unpopulate(val, "Plan", &m.Plan)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &m.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &m.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &m.SystemData)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &m.Tags)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &m.Type)
			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 MaccList.
func (m MaccList) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", m.NextLink)
	populate(objectMap, "value", m.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MaccList.
func (m *MaccList) 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 "nextLink":
			err = unpopulate(val, "NextLink", &m.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &m.Value)
			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 MaccMilestone.
func (m MaccMilestone) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "automaticShortfall", m.AutomaticShortfall)
	populate(objectMap, "automaticShortfallSuppressReason", m.AutomaticShortfallSuppressReason)
	populate(objectMap, "commitment", m.Commitment)
	populateTime[datetime.RFC3339](objectMap, "endAt", m.EndAt)
	populate(objectMap, "milestoneId", m.MilestoneID)
	populate(objectMap, "shortfall", m.Shortfall)
	populate(objectMap, "status", m.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MaccMilestone.
func (m *MaccMilestone) 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 "automaticShortfall":
			err = unpopulate(val, "AutomaticShortfall", &m.AutomaticShortfall)
			delete(rawMsg, key)
		case "automaticShortfallSuppressReason":
			err = unpopulate(val, "AutomaticShortfallSuppressReason", &m.AutomaticShortfallSuppressReason)
			delete(rawMsg, key)
		case "commitment":
			err = unpopulate(val, "Commitment", &m.Commitment)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &m.EndAt)
			delete(rawMsg, key)
		case "milestoneId":
			err = unpopulate(val, "MilestoneID", &m.MilestoneID)
			delete(rawMsg, key)
		case "shortfall":
			err = unpopulate(val, "Shortfall", &m.Shortfall)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &m.Status)
			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 MaccModelProperties.
func (m MaccModelProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "allowContributors", m.AllowContributors)
	populate(objectMap, "automaticShortfall", m.AutomaticShortfall)
	populate(objectMap, "automaticShortfallSuppressReason", m.AutomaticShortfallSuppressReason)
	populate(objectMap, "billingAccountResourceId", m.BillingAccountResourceID)
	populate(objectMap, "commitment", m.Commitment)
	populate(objectMap, "displayName", m.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", m.EndAt)
	populate(objectMap, "entityType", m.EntityType)
	populate(objectMap, "milestones", m.Milestones)
	populate(objectMap, "primaryBillingAccountResourceId", m.PrimaryBillingAccountResourceID)
	populate(objectMap, "primaryResourceId", m.PrimaryResourceID)
	populate(objectMap, "productCode", m.ProductCode)
	populate(objectMap, "provisioningState", m.ProvisioningState)
	populate(objectMap, "resourceId", m.ResourceID)
	populate(objectMap, "shortfall", m.Shortfall)
	populateTime[datetime.RFC3339](objectMap, "startAt", m.StartAt)
	populate(objectMap, "status", m.Status)
	populate(objectMap, "systemId", m.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MaccModelProperties.
func (m *MaccModelProperties) 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 "allowContributors":
			err = unpopulate(val, "AllowContributors", &m.AllowContributors)
			delete(rawMsg, key)
		case "automaticShortfall":
			err = unpopulate(val, "AutomaticShortfall", &m.AutomaticShortfall)
			delete(rawMsg, key)
		case "automaticShortfallSuppressReason":
			err = unpopulate(val, "AutomaticShortfallSuppressReason", &m.AutomaticShortfallSuppressReason)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &m.BillingAccountResourceID)
			delete(rawMsg, key)
		case "commitment":
			err = unpopulate(val, "Commitment", &m.Commitment)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &m.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &m.EndAt)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &m.EntityType)
			delete(rawMsg, key)
		case "milestones":
			err = unpopulate(val, "Milestones", &m.Milestones)
			delete(rawMsg, key)
		case "primaryBillingAccountResourceId":
			err = unpopulate(val, "PrimaryBillingAccountResourceID", &m.PrimaryBillingAccountResourceID)
			delete(rawMsg, key)
		case "primaryResourceId":
			err = unpopulate(val, "PrimaryResourceID", &m.PrimaryResourceID)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &m.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &m.ProvisioningState)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &m.ResourceID)
			delete(rawMsg, key)
		case "shortfall":
			err = unpopulate(val, "Shortfall", &m.Shortfall)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &m.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &m.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &m.SystemID)
			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 MaccPatchRequest.
func (m MaccPatchRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "properties", m.Properties)
	populate(objectMap, "tags", m.Tags)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MaccPatchRequest.
func (m *MaccPatchRequest) 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 "properties":
			err = unpopulate(val, "Properties", &m.Properties)
			delete(rawMsg, key)
		case "tags":
			err = unpopulate(val, "Tags", &m.Tags)
			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 MaccPatchRequestProperties.
func (m MaccPatchRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "allowContributors", m.AllowContributors)
	populate(objectMap, "automaticShortfall", m.AutomaticShortfall)
	populate(objectMap, "automaticShortfallSuppressReason", m.AutomaticShortfallSuppressReason)
	populate(objectMap, "commitment", m.Commitment)
	populate(objectMap, "displayName", m.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", m.EndAt)
	populate(objectMap, "milestones", m.Milestones)
	populate(objectMap, "primaryBillingAccountResourceId", m.PrimaryBillingAccountResourceID)
	populate(objectMap, "primaryResourceId", m.PrimaryResourceID)
	populate(objectMap, "status", m.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MaccPatchRequestProperties.
func (m *MaccPatchRequestProperties) 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 "allowContributors":
			err = unpopulate(val, "AllowContributors", &m.AllowContributors)
			delete(rawMsg, key)
		case "automaticShortfall":
			err = unpopulate(val, "AutomaticShortfall", &m.AutomaticShortfall)
			delete(rawMsg, key)
		case "automaticShortfallSuppressReason":
			err = unpopulate(val, "AutomaticShortfallSuppressReason", &m.AutomaticShortfallSuppressReason)
			delete(rawMsg, key)
		case "commitment":
			err = unpopulate(val, "Commitment", &m.Commitment)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &m.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &m.EndAt)
			delete(rawMsg, key)
		case "milestones":
			err = unpopulate(val, "Milestones", &m.Milestones)
			delete(rawMsg, key)
		case "primaryBillingAccountResourceId":
			err = unpopulate(val, "PrimaryBillingAccountResourceID", &m.PrimaryBillingAccountResourceID)
			delete(rawMsg, key)
		case "primaryResourceId":
			err = unpopulate(val, "PrimaryResourceID", &m.PrimaryResourceID)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &m.Status)
			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 MaccValidateModel.
func (m MaccValidateModel) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	objectMap["benefitType"] = BenefitTypeMACC
	populate(objectMap, "properties", m.Properties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MaccValidateModel.
func (m *MaccValidateModel) 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 "benefitType":
			err = unpopulate(val, "BenefitType", &m.BenefitType)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &m.Properties)
			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 ManagedServiceIdentity.
func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "principalId", m.PrincipalID)
	populate(objectMap, "tenantId", m.TenantID)
	populate(objectMap, "type", m.Type)
	populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity.
func (m *ManagedServiceIdentity) 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 "principalId":
			err = unpopulate(val, "PrincipalID", &m.PrincipalID)
			delete(rawMsg, key)
		case "tenantId":
			err = unpopulate(val, "TenantID", &m.TenantID)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &m.Type)
			delete(rawMsg, key)
		case "userAssignedIdentities":
			err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities)
			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 MarketSetPricesItems.
func (m MarketSetPricesItems) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "currency", m.Currency)
	populate(objectMap, "markets", m.Markets)
	populate(objectMap, "value", m.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type MarketSetPricesItems.
func (m *MarketSetPricesItems) 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 "currency":
			err = unpopulate(val, "Currency", &m.Currency)
			delete(rawMsg, key)
		case "markets":
			err = unpopulate(val, "Markets", &m.Markets)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &m.Value)
			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 Operation.
func (o Operation) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "actionType", o.ActionType)
	populate(objectMap, "display", o.Display)
	populate(objectMap, "isDataAction", o.IsDataAction)
	populate(objectMap, "name", o.Name)
	populate(objectMap, "origin", o.Origin)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Operation.
func (o *Operation) 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 "actionType":
			err = unpopulate(val, "ActionType", &o.ActionType)
			delete(rawMsg, key)
		case "display":
			err = unpopulate(val, "Display", &o.Display)
			delete(rawMsg, key)
		case "isDataAction":
			err = unpopulate(val, "IsDataAction", &o.IsDataAction)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &o.Name)
			delete(rawMsg, key)
		case "origin":
			err = unpopulate(val, "Origin", &o.Origin)
			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 OperationDisplay.
func (o OperationDisplay) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "description", o.Description)
	populate(objectMap, "operation", o.Operation)
	populate(objectMap, "provider", o.Provider)
	populate(objectMap, "resource", o.Resource)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.
func (o *OperationDisplay) 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 "description":
			err = unpopulate(val, "Description", &o.Description)
			delete(rawMsg, key)
		case "operation":
			err = unpopulate(val, "Operation", &o.Operation)
			delete(rawMsg, key)
		case "provider":
			err = unpopulate(val, "Provider", &o.Provider)
			delete(rawMsg, key)
		case "resource":
			err = unpopulate(val, "Resource", &o.Resource)
			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 OperationListResult.
func (o OperationListResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", o.NextLink)
	populate(objectMap, "value", o.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.
func (o *OperationListResult) 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 "nextLink":
			err = unpopulate(val, "NextLink", &o.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &o.Value)
			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 PaymentDetail.
func (p PaymentDetail) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "billingAccount", p.BillingAccount)
	populate(objectMap, "billingCurrencyTotal", p.BillingCurrencyTotal)
	populateTime[datetime.PlainDate](objectMap, "dueDate", p.DueDate)
	populate(objectMap, "extendedStatusInfo", p.ExtendedStatusInfo)
	populateTime[datetime.PlainDate](objectMap, "paymentDate", p.PaymentDate)
	populate(objectMap, "pricingCurrencyTotal", p.PricingCurrencyTotal)
	populate(objectMap, "status", p.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PaymentDetail.
func (p *PaymentDetail) 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 "billingAccount":
			err = unpopulate(val, "BillingAccount", &p.BillingAccount)
			delete(rawMsg, key)
		case "billingCurrencyTotal":
			err = unpopulate(val, "BillingCurrencyTotal", &p.BillingCurrencyTotal)
			delete(rawMsg, key)
		case "dueDate":
			err = unpopulateTime[datetime.PlainDate](val, "DueDate", &p.DueDate)
			delete(rawMsg, key)
		case "extendedStatusInfo":
			err = unpopulate(val, "ExtendedStatusInfo", &p.ExtendedStatusInfo)
			delete(rawMsg, key)
		case "paymentDate":
			err = unpopulateTime[datetime.PlainDate](val, "PaymentDate", &p.PaymentDate)
			delete(rawMsg, key)
		case "pricingCurrencyTotal":
			err = unpopulate(val, "PricingCurrencyTotal", &p.PricingCurrencyTotal)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &p.Status)
			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 Plan.
func (p Plan) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "name", p.Name)
	populate(objectMap, "product", p.Product)
	populate(objectMap, "promotionCode", p.PromotionCode)
	populate(objectMap, "publisher", p.Publisher)
	populate(objectMap, "version", p.Version)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Plan.
func (p *Plan) 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 "name":
			err = unpopulate(val, "Name", &p.Name)
			delete(rawMsg, key)
		case "product":
			err = unpopulate(val, "Product", &p.Product)
			delete(rawMsg, key)
		case "promotionCode":
			err = unpopulate(val, "PromotionCode", &p.PromotionCode)
			delete(rawMsg, key)
		case "publisher":
			err = unpopulate(val, "Publisher", &p.Publisher)
			delete(rawMsg, key)
		case "version":
			err = unpopulate(val, "Version", &p.Version)
			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 Price.
func (p Price) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "amount", p.Amount)
	populate(objectMap, "currencyCode", p.CurrencyCode)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Price.
func (p *Price) 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 "amount":
			err = unpopulate(val, "Amount", &p.Amount)
			delete(rawMsg, key)
		case "currencyCode":
			err = unpopulate(val, "CurrencyCode", &p.CurrencyCode)
			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 PriceGuaranteeProperties.
func (p PriceGuaranteeProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateTime[datetime.RFC3339](objectMap, "priceGuaranteeDate", p.PriceGuaranteeDate)
	populate(objectMap, "pricingPolicy", p.PricingPolicy)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PriceGuaranteeProperties.
func (p *PriceGuaranteeProperties) 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 "priceGuaranteeDate":
			err = unpopulateTime[datetime.RFC3339](val, "PriceGuaranteeDate", &p.PriceGuaranteeDate)
			delete(rawMsg, key)
		case "pricingPolicy":
			err = unpopulate(val, "PricingPolicy", &p.PricingPolicy)
			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 PrimaryConditionalCreditProperties.
func (p PrimaryConditionalCreditProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "allowContributors", p.AllowContributors)
	populate(objectMap, "benefitResourceId", p.BenefitResourceID)
	populate(objectMap, "billingAccountResourceId", p.BillingAccountResourceID)
	populate(objectMap, "displayName", p.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "endAt", p.EndAt)
	objectMap["entityType"] = ConditionalCreditEntityTypePrimary
	populate(objectMap, "milestones", p.Milestones)
	populate(objectMap, "productCode", p.ProductCode)
	populate(objectMap, "provisioningState", p.ProvisioningState)
	populate(objectMap, "resourceId", p.ResourceID)
	populateTime[datetime.RFC3339](objectMap, "startAt", p.StartAt)
	populate(objectMap, "status", p.Status)
	populate(objectMap, "systemId", p.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PrimaryConditionalCreditProperties.
func (p *PrimaryConditionalCreditProperties) 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 "allowContributors":
			err = unpopulate(val, "AllowContributors", &p.AllowContributors)
			delete(rawMsg, key)
		case "benefitResourceId":
			err = unpopulate(val, "BenefitResourceID", &p.BenefitResourceID)
			delete(rawMsg, key)
		case "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &p.BillingAccountResourceID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &p.DisplayName)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &p.EndAt)
			delete(rawMsg, key)
		case "entityType":
			err = unpopulate(val, "EntityType", &p.EntityType)
			delete(rawMsg, key)
		case "milestones":
			err = unpopulate(val, "Milestones", &p.Milestones)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &p.ProductCode)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &p.ProvisioningState)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &p.ResourceID)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &p.StartAt)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &p.Status)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &p.SystemID)
			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 PurchaseRequest.
func (p PurchaseRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "properties", p.Properties)
	populate(objectMap, "sku", p.SKU)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseRequest.
func (p *PurchaseRequest) 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 "properties":
			err = unpopulate(val, "Properties", &p.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &p.SKU)
			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 PurchaseRequestProperties.
func (p PurchaseRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeProperties", p.AppliedScopeProperties)
	populate(objectMap, "appliedScopeType", p.AppliedScopeType)
	populate(objectMap, "billingPlan", p.BillingPlan)
	populate(objectMap, "billingScopeId", p.BillingScopeID)
	populate(objectMap, "commitment", p.Commitment)
	populate(objectMap, "displayName", p.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "effectiveDateTime", p.EffectiveDateTime)
	populate(objectMap, "renew", p.Renew)
	populate(objectMap, "term", p.Term)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseRequestProperties.
func (p *PurchaseRequestProperties) 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 "appliedScopeProperties":
			err = unpopulate(val, "AppliedScopeProperties", &p.AppliedScopeProperties)
			delete(rawMsg, key)
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &p.AppliedScopeType)
			delete(rawMsg, key)
		case "billingPlan":
			err = unpopulate(val, "BillingPlan", &p.BillingPlan)
			delete(rawMsg, key)
		case "billingScopeId":
			err = unpopulate(val, "BillingScopeID", &p.BillingScopeID)
			delete(rawMsg, key)
		case "commitment":
			err = unpopulate(val, "Commitment", &p.Commitment)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &p.DisplayName)
			delete(rawMsg, key)
		case "effectiveDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "EffectiveDateTime", &p.EffectiveDateTime)
			delete(rawMsg, key)
		case "renew":
			err = unpopulate(val, "Renew", &p.Renew)
			delete(rawMsg, key)
		case "term":
			err = unpopulate(val, "Term", &p.Term)
			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 RenewProperties.
func (r RenewProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "purchaseProperties", r.PurchaseProperties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type RenewProperties.
func (r *RenewProperties) 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 "purchaseProperties":
			err = unpopulate(val, "PurchaseProperties", &r.PurchaseProperties)
			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 ReservationOrderAliasRequest.
func (r ReservationOrderAliasRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", r.ID)
	populate(objectMap, "location", r.Location)
	populate(objectMap, "name", r.Name)
	populate(objectMap, "properties", r.Properties)
	populate(objectMap, "sku", r.SKU)
	populate(objectMap, "systemData", r.SystemData)
	populate(objectMap, "type", r.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderAliasRequest.
func (r *ReservationOrderAliasRequest) 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 "id":
			err = unpopulate(val, "ID", &r.ID)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &r.Location)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &r.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &r.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &r.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &r.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &r.Type)
			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 ReservationOrderAliasRequestProperties.
func (r ReservationOrderAliasRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeProperties", r.AppliedScopeProperties)
	populate(objectMap, "appliedScopeType", r.AppliedScopeType)
	populate(objectMap, "billingPlan", r.BillingPlan)
	populate(objectMap, "billingScopeId", r.BillingScopeID)
	populate(objectMap, "displayName", r.DisplayName)
	populate(objectMap, "quantity", r.Quantity)
	populate(objectMap, "renew", r.Renew)
	populate(objectMap, "reservedResourceProperties", r.ReservedResourceProperties)
	populate(objectMap, "reservedResourceType", r.ReservedResourceType)
	populateTime[datetime.RFC3339](objectMap, "reviewDateTime", r.ReviewDateTime)
	populate(objectMap, "term", r.Term)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderAliasRequestProperties.
func (r *ReservationOrderAliasRequestProperties) 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 "appliedScopeProperties":
			err = unpopulate(val, "AppliedScopeProperties", &r.AppliedScopeProperties)
			delete(rawMsg, key)
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &r.AppliedScopeType)
			delete(rawMsg, key)
		case "billingPlan":
			err = unpopulate(val, "BillingPlan", &r.BillingPlan)
			delete(rawMsg, key)
		case "billingScopeId":
			err = unpopulate(val, "BillingScopeID", &r.BillingScopeID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &r.DisplayName)
			delete(rawMsg, key)
		case "quantity":
			err = unpopulate(val, "Quantity", &r.Quantity)
			delete(rawMsg, key)
		case "renew":
			err = unpopulate(val, "Renew", &r.Renew)
			delete(rawMsg, key)
		case "reservedResourceProperties":
			err = unpopulate(val, "ReservedResourceProperties", &r.ReservedResourceProperties)
			delete(rawMsg, key)
		case "reservedResourceType":
			err = unpopulate(val, "ReservedResourceType", &r.ReservedResourceType)
			delete(rawMsg, key)
		case "reviewDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "ReviewDateTime", &r.ReviewDateTime)
			delete(rawMsg, key)
		case "term":
			err = unpopulate(val, "Term", &r.Term)
			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 ReservationOrderAliasRequestPropertiesReservedResourceProperties.
func (r ReservationOrderAliasRequestPropertiesReservedResourceProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "instanceFlexibility", r.InstanceFlexibility)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderAliasRequestPropertiesReservedResourceProperties.
func (r *ReservationOrderAliasRequestPropertiesReservedResourceProperties) 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 "instanceFlexibility":
			err = unpopulate(val, "InstanceFlexibility", &r.InstanceFlexibility)
			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 ReservationOrderAliasResponse.
func (r ReservationOrderAliasResponse) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", r.ID)
	populate(objectMap, "location", r.Location)
	populate(objectMap, "name", r.Name)
	populate(objectMap, "properties", r.Properties)
	populate(objectMap, "sku", r.SKU)
	populate(objectMap, "systemData", r.SystemData)
	populate(objectMap, "type", r.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderAliasResponse.
func (r *ReservationOrderAliasResponse) 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 "id":
			err = unpopulate(val, "ID", &r.ID)
			delete(rawMsg, key)
		case "location":
			err = unpopulate(val, "Location", &r.Location)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &r.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &r.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &r.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &r.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &r.Type)
			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 ReservationOrderAliasResponseProperties.
func (r ReservationOrderAliasResponseProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeProperties", r.AppliedScopeProperties)
	populate(objectMap, "appliedScopeType", r.AppliedScopeType)
	populate(objectMap, "billingPlan", r.BillingPlan)
	populate(objectMap, "billingScopeId", r.BillingScopeID)
	populate(objectMap, "displayName", r.DisplayName)
	populate(objectMap, "provisioningState", r.ProvisioningState)
	populate(objectMap, "quantity", r.Quantity)
	populate(objectMap, "renew", r.Renew)
	populate(objectMap, "reservationOrderId", r.ReservationOrderID)
	populate(objectMap, "reservedResourceProperties", r.ReservedResourceProperties)
	populate(objectMap, "reservedResourceType", r.ReservedResourceType)
	populateTime[datetime.RFC3339](objectMap, "reviewDateTime", r.ReviewDateTime)
	populate(objectMap, "term", r.Term)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderAliasResponseProperties.
func (r *ReservationOrderAliasResponseProperties) 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 "appliedScopeProperties":
			err = unpopulate(val, "AppliedScopeProperties", &r.AppliedScopeProperties)
			delete(rawMsg, key)
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &r.AppliedScopeType)
			delete(rawMsg, key)
		case "billingPlan":
			err = unpopulate(val, "BillingPlan", &r.BillingPlan)
			delete(rawMsg, key)
		case "billingScopeId":
			err = unpopulate(val, "BillingScopeID", &r.BillingScopeID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &r.DisplayName)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &r.ProvisioningState)
			delete(rawMsg, key)
		case "quantity":
			err = unpopulate(val, "Quantity", &r.Quantity)
			delete(rawMsg, key)
		case "renew":
			err = unpopulate(val, "Renew", &r.Renew)
			delete(rawMsg, key)
		case "reservationOrderId":
			err = unpopulate(val, "ReservationOrderID", &r.ReservationOrderID)
			delete(rawMsg, key)
		case "reservedResourceProperties":
			err = unpopulate(val, "ReservedResourceProperties", &r.ReservedResourceProperties)
			delete(rawMsg, key)
		case "reservedResourceType":
			err = unpopulate(val, "ReservedResourceType", &r.ReservedResourceType)
			delete(rawMsg, key)
		case "reviewDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "ReviewDateTime", &r.ReviewDateTime)
			delete(rawMsg, key)
		case "term":
			err = unpopulate(val, "Term", &r.Term)
			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 ReservationOrderAliasResponsePropertiesReservedResourceProperties.
func (r ReservationOrderAliasResponsePropertiesReservedResourceProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "instanceFlexibility", r.InstanceFlexibility)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderAliasResponsePropertiesReservedResourceProperties.
func (r *ReservationOrderAliasResponsePropertiesReservedResourceProperties) 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 "instanceFlexibility":
			err = unpopulate(val, "InstanceFlexibility", &r.InstanceFlexibility)
			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 ResourceSKU.
func (r ResourceSKU) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "name", r.Name)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU.
func (r *ResourceSKU) 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 "name":
			err = unpopulate(val, "Name", &r.Name)
			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 RoleAssignmentEntity.
func (r RoleAssignmentEntity) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", r.ID)
	populate(objectMap, "name", r.Name)
	populate(objectMap, "properties", r.Properties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentEntity.
func (r *RoleAssignmentEntity) 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 "id":
			err = unpopulate(val, "ID", &r.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &r.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &r.Properties)
			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 RoleAssignmentEntityProperties.
func (r RoleAssignmentEntityProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "principalId", r.PrincipalID)
	populate(objectMap, "roleDefinitionId", r.RoleDefinitionID)
	populate(objectMap, "scope", r.Scope)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentEntityProperties.
func (r *RoleAssignmentEntityProperties) 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 "principalId":
			err = unpopulate(val, "PrincipalID", &r.PrincipalID)
			delete(rawMsg, key)
		case "roleDefinitionId":
			err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID)
			delete(rawMsg, key)
		case "scope":
			err = unpopulate(val, "Scope", &r.Scope)
			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 SKU.
func (s SKU) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "capacity", s.Capacity)
	populate(objectMap, "family", s.Family)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "size", s.Size)
	populate(objectMap, "tier", s.Tier)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SKU.
func (s *SKU) 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 "capacity":
			err = unpopulate(val, "Capacity", &s.Capacity)
			delete(rawMsg, key)
		case "family":
			err = unpopulate(val, "Family", &s.Family)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "size":
			err = unpopulate(val, "Size", &s.Size)
			delete(rawMsg, key)
		case "tier":
			err = unpopulate(val, "Tier", &s.Tier)
			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 SavingsPlanModel.
func (s SavingsPlanModel) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", s.ID)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "properties", s.Properties)
	populate(objectMap, "sku", s.SKU)
	populate(objectMap, "systemData", s.SystemData)
	populate(objectMap, "type", s.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanModel.
func (s *SavingsPlanModel) 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 "id":
			err = unpopulate(val, "ID", &s.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &s.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &s.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			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 SavingsPlanModelList.
func (s SavingsPlanModelList) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", s.NextLink)
	populate(objectMap, "value", s.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanModelList.
func (s *SavingsPlanModelList) 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 "nextLink":
			err = unpopulate(val, "NextLink", &s.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &s.Value)
			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 SavingsPlanModelListResult.
func (s SavingsPlanModelListResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "additionalProperties", s.AdditionalProperties)
	populate(objectMap, "nextLink", s.NextLink)
	populate(objectMap, "value", s.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanModelListResult.
func (s *SavingsPlanModelListResult) 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 "additionalProperties":
			err = unpopulate(val, "AdditionalProperties", &s.AdditionalProperties)
			delete(rawMsg, key)
		case "nextLink":
			err = unpopulate(val, "NextLink", &s.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &s.Value)
			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 SavingsPlanModelProperties.
func (s SavingsPlanModelProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeProperties", s.AppliedScopeProperties)
	populate(objectMap, "appliedScopeType", s.AppliedScopeType)
	populateTime[datetime.RFC3339](objectMap, "benefitStartTime", s.BenefitStartTime)
	populate(objectMap, "billingAccountId", s.BillingAccountID)
	populate(objectMap, "billingPlan", s.BillingPlan)
	populate(objectMap, "billingProfileId", s.BillingProfileID)
	populate(objectMap, "billingScopeId", s.BillingScopeID)
	populate(objectMap, "commitment", s.Commitment)
	populate(objectMap, "customerId", s.CustomerID)
	populate(objectMap, "displayName", s.DisplayName)
	populate(objectMap, "displayProvisioningState", s.DisplayProvisioningState)
	populateTime[datetime.RFC3339](objectMap, "effectiveDateTime", s.EffectiveDateTime)
	populateTime[datetime.RFC3339](objectMap, "expiryDateTime", s.ExpiryDateTime)
	populate(objectMap, "extendedStatusInfo", s.ExtendedStatusInfo)
	populate(objectMap, "provisioningState", s.ProvisioningState)
	populateTime[datetime.RFC3339](objectMap, "purchaseDateTime", s.PurchaseDateTime)
	populate(objectMap, "renew", s.Renew)
	populate(objectMap, "renewDestination", s.RenewDestination)
	populate(objectMap, "renewProperties", s.RenewProperties)
	populate(objectMap, "renewSource", s.RenewSource)
	populate(objectMap, "term", s.Term)
	populate(objectMap, "userFriendlyAppliedScopeType", s.UserFriendlyAppliedScopeType)
	populate(objectMap, "utilization", s.Utilization)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanModelProperties.
func (s *SavingsPlanModelProperties) 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 "appliedScopeProperties":
			err = unpopulate(val, "AppliedScopeProperties", &s.AppliedScopeProperties)
			delete(rawMsg, key)
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &s.AppliedScopeType)
			delete(rawMsg, key)
		case "benefitStartTime":
			err = unpopulateTime[datetime.RFC3339](val, "BenefitStartTime", &s.BenefitStartTime)
			delete(rawMsg, key)
		case "billingAccountId":
			err = unpopulate(val, "BillingAccountID", &s.BillingAccountID)
			delete(rawMsg, key)
		case "billingPlan":
			err = unpopulate(val, "BillingPlan", &s.BillingPlan)
			delete(rawMsg, key)
		case "billingProfileId":
			err = unpopulate(val, "BillingProfileID", &s.BillingProfileID)
			delete(rawMsg, key)
		case "billingScopeId":
			err = unpopulate(val, "BillingScopeID", &s.BillingScopeID)
			delete(rawMsg, key)
		case "commitment":
			err = unpopulate(val, "Commitment", &s.Commitment)
			delete(rawMsg, key)
		case "customerId":
			err = unpopulate(val, "CustomerID", &s.CustomerID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &s.DisplayName)
			delete(rawMsg, key)
		case "displayProvisioningState":
			err = unpopulate(val, "DisplayProvisioningState", &s.DisplayProvisioningState)
			delete(rawMsg, key)
		case "effectiveDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "EffectiveDateTime", &s.EffectiveDateTime)
			delete(rawMsg, key)
		case "expiryDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "ExpiryDateTime", &s.ExpiryDateTime)
			delete(rawMsg, key)
		case "extendedStatusInfo":
			err = unpopulate(val, "ExtendedStatusInfo", &s.ExtendedStatusInfo)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &s.ProvisioningState)
			delete(rawMsg, key)
		case "purchaseDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "PurchaseDateTime", &s.PurchaseDateTime)
			delete(rawMsg, key)
		case "renew":
			err = unpopulate(val, "Renew", &s.Renew)
			delete(rawMsg, key)
		case "renewDestination":
			err = unpopulate(val, "RenewDestination", &s.RenewDestination)
			delete(rawMsg, key)
		case "renewProperties":
			err = unpopulate(val, "RenewProperties", &s.RenewProperties)
			delete(rawMsg, key)
		case "renewSource":
			err = unpopulate(val, "RenewSource", &s.RenewSource)
			delete(rawMsg, key)
		case "term":
			err = unpopulate(val, "Term", &s.Term)
			delete(rawMsg, key)
		case "userFriendlyAppliedScopeType":
			err = unpopulate(val, "UserFriendlyAppliedScopeType", &s.UserFriendlyAppliedScopeType)
			delete(rawMsg, key)
		case "utilization":
			err = unpopulate(val, "Utilization", &s.Utilization)
			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 SavingsPlanOrderAliasModel.
func (s SavingsPlanOrderAliasModel) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", s.ID)
	populate(objectMap, "kind", s.Kind)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "properties", s.Properties)
	populate(objectMap, "sku", s.SKU)
	populate(objectMap, "systemData", s.SystemData)
	populate(objectMap, "type", s.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanOrderAliasModel.
func (s *SavingsPlanOrderAliasModel) 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 "id":
			err = unpopulate(val, "ID", &s.ID)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &s.Kind)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &s.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &s.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			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 SavingsPlanOrderAliasProperties.
func (s SavingsPlanOrderAliasProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeProperties", s.AppliedScopeProperties)
	populate(objectMap, "appliedScopeType", s.AppliedScopeType)
	populate(objectMap, "billingPlan", s.BillingPlan)
	populate(objectMap, "billingScopeId", s.BillingScopeID)
	populate(objectMap, "commitment", s.Commitment)
	populate(objectMap, "displayName", s.DisplayName)
	populate(objectMap, "provisioningState", s.ProvisioningState)
	populate(objectMap, "renew", s.Renew)
	populate(objectMap, "savingsPlanOrderId", s.SavingsPlanOrderID)
	populate(objectMap, "term", s.Term)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanOrderAliasProperties.
func (s *SavingsPlanOrderAliasProperties) 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 "appliedScopeProperties":
			err = unpopulate(val, "AppliedScopeProperties", &s.AppliedScopeProperties)
			delete(rawMsg, key)
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &s.AppliedScopeType)
			delete(rawMsg, key)
		case "billingPlan":
			err = unpopulate(val, "BillingPlan", &s.BillingPlan)
			delete(rawMsg, key)
		case "billingScopeId":
			err = unpopulate(val, "BillingScopeID", &s.BillingScopeID)
			delete(rawMsg, key)
		case "commitment":
			err = unpopulate(val, "Commitment", &s.Commitment)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &s.DisplayName)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &s.ProvisioningState)
			delete(rawMsg, key)
		case "renew":
			err = unpopulate(val, "Renew", &s.Renew)
			delete(rawMsg, key)
		case "savingsPlanOrderId":
			err = unpopulate(val, "SavingsPlanOrderID", &s.SavingsPlanOrderID)
			delete(rawMsg, key)
		case "term":
			err = unpopulate(val, "Term", &s.Term)
			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 SavingsPlanOrderModel.
func (s SavingsPlanOrderModel) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "id", s.ID)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "properties", s.Properties)
	populate(objectMap, "sku", s.SKU)
	populate(objectMap, "systemData", s.SystemData)
	populate(objectMap, "type", s.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanOrderModel.
func (s *SavingsPlanOrderModel) 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 "id":
			err = unpopulate(val, "ID", &s.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &s.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &s.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			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 SavingsPlanOrderModelList.
func (s SavingsPlanOrderModelList) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "nextLink", s.NextLink)
	populate(objectMap, "value", s.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanOrderModelList.
func (s *SavingsPlanOrderModelList) 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 "nextLink":
			err = unpopulate(val, "NextLink", &s.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &s.Value)
			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 SavingsPlanOrderModelProperties.
func (s SavingsPlanOrderModelProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populateTime[datetime.RFC3339](objectMap, "benefitStartTime", s.BenefitStartTime)
	populate(objectMap, "billingAccountId", s.BillingAccountID)
	populate(objectMap, "billingPlan", s.BillingPlan)
	populate(objectMap, "billingProfileId", s.BillingProfileID)
	populate(objectMap, "billingScopeId", s.BillingScopeID)
	populate(objectMap, "customerId", s.CustomerID)
	populate(objectMap, "displayName", s.DisplayName)
	populateTime[datetime.RFC3339](objectMap, "expiryDateTime", s.ExpiryDateTime)
	populate(objectMap, "extendedStatusInfo", s.ExtendedStatusInfo)
	populate(objectMap, "planInformation", s.PlanInformation)
	populate(objectMap, "provisioningState", s.ProvisioningState)
	populate(objectMap, "savingsPlans", s.SavingsPlans)
	populate(objectMap, "term", s.Term)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanOrderModelProperties.
func (s *SavingsPlanOrderModelProperties) 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 "benefitStartTime":
			err = unpopulateTime[datetime.RFC3339](val, "BenefitStartTime", &s.BenefitStartTime)
			delete(rawMsg, key)
		case "billingAccountId":
			err = unpopulate(val, "BillingAccountID", &s.BillingAccountID)
			delete(rawMsg, key)
		case "billingPlan":
			err = unpopulate(val, "BillingPlan", &s.BillingPlan)
			delete(rawMsg, key)
		case "billingProfileId":
			err = unpopulate(val, "BillingProfileID", &s.BillingProfileID)
			delete(rawMsg, key)
		case "billingScopeId":
			err = unpopulate(val, "BillingScopeID", &s.BillingScopeID)
			delete(rawMsg, key)
		case "customerId":
			err = unpopulate(val, "CustomerID", &s.CustomerID)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &s.DisplayName)
			delete(rawMsg, key)
		case "expiryDateTime":
			err = unpopulateTime[datetime.RFC3339](val, "ExpiryDateTime", &s.ExpiryDateTime)
			delete(rawMsg, key)
		case "extendedStatusInfo":
			err = unpopulate(val, "ExtendedStatusInfo", &s.ExtendedStatusInfo)
			delete(rawMsg, key)
		case "planInformation":
			err = unpopulate(val, "PlanInformation", &s.PlanInformation)
			delete(rawMsg, key)
		case "provisioningState":
			err = unpopulate(val, "ProvisioningState", &s.ProvisioningState)
			delete(rawMsg, key)
		case "savingsPlans":
			err = unpopulate(val, "SavingsPlans", &s.SavingsPlans)
			delete(rawMsg, key)
		case "term":
			err = unpopulate(val, "Term", &s.Term)
			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 SavingsPlanSummary.
func (s SavingsPlanSummary) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "value", s.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanSummary.
func (s *SavingsPlanSummary) 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 "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &s.Value)
			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 SavingsPlanSummaryCount.
func (s SavingsPlanSummaryCount) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "cancelledCount", s.CancelledCount)
	populate(objectMap, "expiredCount", s.ExpiredCount)
	populate(objectMap, "expiringCount", s.ExpiringCount)
	populate(objectMap, "failedCount", s.FailedCount)
	populate(objectMap, "noBenefitCount", s.NoBenefitCount)
	populate(objectMap, "pendingCount", s.PendingCount)
	populate(objectMap, "processingCount", s.ProcessingCount)
	populate(objectMap, "succeededCount", s.SucceededCount)
	populate(objectMap, "warningCount", s.WarningCount)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanSummaryCount.
func (s *SavingsPlanSummaryCount) 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 "cancelledCount":
			err = unpopulate(val, "CancelledCount", &s.CancelledCount)
			delete(rawMsg, key)
		case "expiredCount":
			err = unpopulate(val, "ExpiredCount", &s.ExpiredCount)
			delete(rawMsg, key)
		case "expiringCount":
			err = unpopulate(val, "ExpiringCount", &s.ExpiringCount)
			delete(rawMsg, key)
		case "failedCount":
			err = unpopulate(val, "FailedCount", &s.FailedCount)
			delete(rawMsg, key)
		case "noBenefitCount":
			err = unpopulate(val, "NoBenefitCount", &s.NoBenefitCount)
			delete(rawMsg, key)
		case "pendingCount":
			err = unpopulate(val, "PendingCount", &s.PendingCount)
			delete(rawMsg, key)
		case "processingCount":
			err = unpopulate(val, "ProcessingCount", &s.ProcessingCount)
			delete(rawMsg, key)
		case "succeededCount":
			err = unpopulate(val, "SucceededCount", &s.SucceededCount)
			delete(rawMsg, key)
		case "warningCount":
			err = unpopulate(val, "WarningCount", &s.WarningCount)
			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 SavingsPlanUpdateRequest.
func (s SavingsPlanUpdateRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "properties", s.Properties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanUpdateRequest.
func (s *SavingsPlanUpdateRequest) 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 "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			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 SavingsPlanUpdateRequestProperties.
func (s SavingsPlanUpdateRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "appliedScopeProperties", s.AppliedScopeProperties)
	populate(objectMap, "appliedScopeType", s.AppliedScopeType)
	populate(objectMap, "displayName", s.DisplayName)
	populate(objectMap, "renew", s.Renew)
	populate(objectMap, "renewProperties", s.RenewProperties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanUpdateRequestProperties.
func (s *SavingsPlanUpdateRequestProperties) 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 "appliedScopeProperties":
			err = unpopulate(val, "AppliedScopeProperties", &s.AppliedScopeProperties)
			delete(rawMsg, key)
		case "appliedScopeType":
			err = unpopulate(val, "AppliedScopeType", &s.AppliedScopeType)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &s.DisplayName)
			delete(rawMsg, key)
		case "renew":
			err = unpopulate(val, "Renew", &s.Renew)
			delete(rawMsg, key)
		case "renewProperties":
			err = unpopulate(val, "RenewProperties", &s.RenewProperties)
			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 SavingsPlanUpdateValidateRequest.
func (s SavingsPlanUpdateValidateRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefits", s.Benefits)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanUpdateValidateRequest.
func (s *SavingsPlanUpdateValidateRequest) 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 "benefits":
			err = unpopulate(val, "Benefits", &s.Benefits)
			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 SavingsPlanValidResponseProperty.
func (s SavingsPlanValidResponseProperty) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "reason", s.Reason)
	populate(objectMap, "reasonCode", s.ReasonCode)
	populate(objectMap, "valid", s.Valid)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanValidResponseProperty.
func (s *SavingsPlanValidResponseProperty) 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 "reason":
			err = unpopulate(val, "Reason", &s.Reason)
			delete(rawMsg, key)
		case "reasonCode":
			err = unpopulate(val, "ReasonCode", &s.ReasonCode)
			delete(rawMsg, key)
		case "valid":
			err = unpopulate(val, "Valid", &s.Valid)
			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 SavingsPlanValidateModel.
func (s SavingsPlanValidateModel) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	objectMap["benefitType"] = BenefitTypeSavingsPlan
	populate(objectMap, "id", s.ID)
	populate(objectMap, "kind", s.Kind)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "properties", s.Properties)
	populate(objectMap, "sku", s.SKU)
	populate(objectMap, "systemData", s.SystemData)
	populate(objectMap, "type", s.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanValidateModel.
func (s *SavingsPlanValidateModel) 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 "benefitType":
			err = unpopulate(val, "BenefitType", &s.BenefitType)
			delete(rawMsg, key)
		case "id":
			err = unpopulate(val, "ID", &s.ID)
			delete(rawMsg, key)
		case "kind":
			err = unpopulate(val, "Kind", &s.Kind)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			delete(rawMsg, key)
		case "sku":
			err = unpopulate(val, "SKU", &s.SKU)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &s.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			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 SavingsPlanValidateResponse.
func (s SavingsPlanValidateResponse) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "benefits", s.Benefits)
	populate(objectMap, "nextLink", s.NextLink)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanValidateResponse.
func (s *SavingsPlanValidateResponse) 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 "benefits":
			err = unpopulate(val, "Benefits", &s.Benefits)
			delete(rawMsg, key)
		case "nextLink":
			err = unpopulate(val, "NextLink", &s.NextLink)
			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 SellerResourceListRequest.
func (s SellerResourceListRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "properties", s.Properties)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SellerResourceListRequest.
func (s *SellerResourceListRequest) 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 "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			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 SellerResourceListRequestProperties.
func (s SellerResourceListRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "billingAccountResourceId", s.BillingAccountResourceID)
	populate(objectMap, "contributors", s.Contributors)
	populate(objectMap, "$filter", s.Filter)
	populate(objectMap, "milestones", s.Milestones)
	populate(objectMap, "primaryResourceId", s.PrimaryResourceID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SellerResourceListRequestProperties.
func (s *SellerResourceListRequestProperties) 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 "billingAccountResourceId":
			err = unpopulate(val, "BillingAccountResourceID", &s.BillingAccountResourceID)
			delete(rawMsg, key)
		case "contributors":
			err = unpopulate(val, "Contributors", &s.Contributors)
			delete(rawMsg, key)
		case "$filter":
			err = unpopulate(val, "Filter", &s.Filter)
			delete(rawMsg, key)
		case "milestones":
			err = unpopulate(val, "Milestones", &s.Milestones)
			delete(rawMsg, key)
		case "primaryResourceId":
			err = unpopulate(val, "PrimaryResourceID", &s.PrimaryResourceID)
			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 ServiceManagedIdentity.
func (s ServiceManagedIdentity) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "principalId", s.PrincipalID)
	populate(objectMap, "tenantId", s.TenantID)
	populate(objectMap, "type", s.Type)
	populate(objectMap, "userAssignedIdentities", s.UserAssignedIdentities)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceManagedIdentity.
func (s *ServiceManagedIdentity) 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 "principalId":
			err = unpopulate(val, "PrincipalID", &s.PrincipalID)
			delete(rawMsg, key)
		case "tenantId":
			err = unpopulate(val, "TenantID", &s.TenantID)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			delete(rawMsg, key)
		case "userAssignedIdentities":
			err = unpopulate(val, "UserAssignedIdentities", &s.UserAssignedIdentities)
			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 Shortfall.
func (s Shortfall) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "balanceVersion", s.BalanceVersion)
	populate(objectMap, "charge", s.Charge)
	populateTime[datetime.RFC3339](objectMap, "endAt", s.EndAt)
	populate(objectMap, "productCode", s.ProductCode)
	populate(objectMap, "resourceId", s.ResourceID)
	populateTime[datetime.RFC3339](objectMap, "startAt", s.StartAt)
	populate(objectMap, "systemId", s.SystemID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Shortfall.
func (s *Shortfall) 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 "balanceVersion":
			err = unpopulate(val, "BalanceVersion", &s.BalanceVersion)
			delete(rawMsg, key)
		case "charge":
			err = unpopulate(val, "Charge", &s.Charge)
			delete(rawMsg, key)
		case "endAt":
			err = unpopulateTime[datetime.RFC3339](val, "EndAt", &s.EndAt)
			delete(rawMsg, key)
		case "productCode":
			err = unpopulate(val, "ProductCode", &s.ProductCode)
			delete(rawMsg, key)
		case "resourceId":
			err = unpopulate(val, "ResourceID", &s.ResourceID)
			delete(rawMsg, key)
		case "startAt":
			err = unpopulateTime[datetime.RFC3339](val, "StartAt", &s.StartAt)
			delete(rawMsg, key)
		case "systemId":
			err = unpopulate(val, "SystemID", &s.SystemID)
			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)
	populateTime[datetime.RFC3339](objectMap, "createdAt", s.CreatedAt)
	populate(objectMap, "createdBy", s.CreatedBy)
	populate(objectMap, "createdByType", s.CreatedByType)
	populateTime[datetime.RFC3339](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 = unpopulateTime[datetime.RFC3339](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 = unpopulateTime[datetime.RFC3339](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 UserAssignedIdentity.
func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "clientId", u.ClientID)
	populate(objectMap, "principalId", u.PrincipalID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity.
func (u *UserAssignedIdentity) 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", u, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "clientId":
			err = unpopulate(val, "ClientID", &u.ClientID)
			delete(rawMsg, key)
		case "principalId":
			err = unpopulate(val, "PrincipalID", &u.PrincipalID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", u, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type Utilization.
func (u Utilization) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "aggregates", u.Aggregates)
	populate(objectMap, "trend", u.Trend)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Utilization.
func (u *Utilization) 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", u, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "aggregates":
			err = unpopulate(val, "Aggregates", &u.Aggregates)
			delete(rawMsg, key)
		case "trend":
			err = unpopulate(val, "Trend", &u.Trend)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", u, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type UtilizationAggregates.
func (u UtilizationAggregates) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]any)
	populate(objectMap, "grain", u.Grain)
	populate(objectMap, "grainUnit", u.GrainUnit)
	populate(objectMap, "value", u.Value)
	populate(objectMap, "valueUnit", u.ValueUnit)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type UtilizationAggregates.
func (u *UtilizationAggregates) 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", u, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "grain":
			err = unpopulate(val, "Grain", &u.Grain)
			delete(rawMsg, key)
		case "grainUnit":
			err = unpopulate(val, "GrainUnit", &u.GrainUnit)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &u.Value)
			delete(rawMsg, key)
		case "valueUnit":
			err = unpopulate(val, "ValueUnit", &u.ValueUnit)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", u, 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 populateTime[T dateTimeConstraints](m map[string]any, k string, t *time.Time) {
	if t == nil {
		return
	} else if azcore.IsNullValue(t) {
		m[k] = nil
	} else if !reflect.ValueOf(t).IsNil() {
		newTime := T(*t)
		m[k] = (*T)(&newTime)
	}
}

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
}

func unpopulateTime[T dateTimeConstraints](data json.RawMessage, fn string, t **time.Time) error {
	if data == nil || string(data) == "null" {
		return nil
	}
	var aux T
	if err := json.Unmarshal(data, &aux); err != nil {
		return fmt.Errorf("struct field %s: %v", fn, err)
	}
	newTime := time.Time(aux)
	*t = &newTime
	return nil
}

type dateTimeConstraints interface {
	datetime.PlainDate | datetime.PlainTime | datetime.RFC1123 | datetime.RFC3339 | datetime.Unix
}
