// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
// All rights reserved.
//
// Licensed under the Mozilla Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://mozilla.org/MPL/2.0/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: MPL-2.0

// Code generated by "gen/generator.go"; DO NOT EDIT.

package provider

// Section below is generated&owned by "gen/generator.go". //template:begin imports
import (
	"context"
	"fmt"
	"reflect"
	"regexp"
	"strconv"
	"strings"

	"github.com/CiscoDevNet/terraform-provider-iosxe/internal/provider/helpers"
	"github.com/hashicorp/terraform-plugin-framework/types"
	"github.com/tidwall/gjson"
	"github.com/tidwall/sjson"
)

// End of section. //template:end imports

// Section below is generated&owned by "gen/generator.go". //template:begin types
type NTP struct {
	Device                        types.String            `tfsdk:"device"`
	Id                            types.String            `tfsdk:"id"`
	DeleteMode                    types.String            `tfsdk:"delete_mode"`
	Authenticate                  types.Bool              `tfsdk:"authenticate"`
	Logging                       types.Bool              `tfsdk:"logging"`
	AccessGroupPeerAcl            types.String            `tfsdk:"access_group_peer_acl"`
	AccessGroupQueryOnlyAcl       types.String            `tfsdk:"access_group_query_only_acl"`
	AccessGroupServeAcl           types.String            `tfsdk:"access_group_serve_acl"`
	AccessGroupServeOnlyAcl       types.String            `tfsdk:"access_group_serve_only_acl"`
	AuthenticationKeys            []NTPAuthenticationKeys `tfsdk:"authentication_keys"`
	ClockPeriod                   types.Int64             `tfsdk:"clock_period"`
	Master                        types.Bool              `tfsdk:"master"`
	MasterStratum                 types.Int64             `tfsdk:"master_stratum"`
	Passive                       types.Bool              `tfsdk:"passive"`
	UpdateCalendar                types.Bool              `tfsdk:"update_calendar"`
	SourceGigabitEthernet         types.String            `tfsdk:"source_gigabit_ethernet"`
	SourceTenGigabitEthernet      types.String            `tfsdk:"source_ten_gigabit_ethernet"`
	SourceFortyGigabitEthernet    types.String            `tfsdk:"source_forty_gigabit_ethernet"`
	SourceHundredGigabitEthernet  types.String            `tfsdk:"source_hundred_gigabit_ethernet"`
	SourceLoopback                types.Int64             `tfsdk:"source_loopback"`
	SourcePortChannel             types.Int64             `tfsdk:"source_port_channel"`
	SourcePortChannelSubinterface types.String            `tfsdk:"source_port_channel_subinterface"`
	SourceVlan                    types.Int64             `tfsdk:"source_vlan"`
	Servers                       []NTPServers            `tfsdk:"servers"`
	ServerVrfs                    []NTPServerVrfs         `tfsdk:"server_vrfs"`
	Peers                         []NTPPeers              `tfsdk:"peers"`
	PeerVrfs                      []NTPPeerVrfs           `tfsdk:"peer_vrfs"`
	TrustedKeys                   []NTPTrustedKeys        `tfsdk:"trusted_keys"`
}

type NTPData struct {
	Device                        types.String            `tfsdk:"device"`
	Id                            types.String            `tfsdk:"id"`
	Authenticate                  types.Bool              `tfsdk:"authenticate"`
	Logging                       types.Bool              `tfsdk:"logging"`
	AccessGroupPeerAcl            types.String            `tfsdk:"access_group_peer_acl"`
	AccessGroupQueryOnlyAcl       types.String            `tfsdk:"access_group_query_only_acl"`
	AccessGroupServeAcl           types.String            `tfsdk:"access_group_serve_acl"`
	AccessGroupServeOnlyAcl       types.String            `tfsdk:"access_group_serve_only_acl"`
	AuthenticationKeys            []NTPAuthenticationKeys `tfsdk:"authentication_keys"`
	ClockPeriod                   types.Int64             `tfsdk:"clock_period"`
	Master                        types.Bool              `tfsdk:"master"`
	MasterStratum                 types.Int64             `tfsdk:"master_stratum"`
	Passive                       types.Bool              `tfsdk:"passive"`
	UpdateCalendar                types.Bool              `tfsdk:"update_calendar"`
	SourceGigabitEthernet         types.String            `tfsdk:"source_gigabit_ethernet"`
	SourceTenGigabitEthernet      types.String            `tfsdk:"source_ten_gigabit_ethernet"`
	SourceFortyGigabitEthernet    types.String            `tfsdk:"source_forty_gigabit_ethernet"`
	SourceHundredGigabitEthernet  types.String            `tfsdk:"source_hundred_gigabit_ethernet"`
	SourceLoopback                types.Int64             `tfsdk:"source_loopback"`
	SourcePortChannel             types.Int64             `tfsdk:"source_port_channel"`
	SourcePortChannelSubinterface types.String            `tfsdk:"source_port_channel_subinterface"`
	SourceVlan                    types.Int64             `tfsdk:"source_vlan"`
	Servers                       []NTPServers            `tfsdk:"servers"`
	ServerVrfs                    []NTPServerVrfs         `tfsdk:"server_vrfs"`
	Peers                         []NTPPeers              `tfsdk:"peers"`
	PeerVrfs                      []NTPPeerVrfs           `tfsdk:"peer_vrfs"`
	TrustedKeys                   []NTPTrustedKeys        `tfsdk:"trusted_keys"`
}
type NTPAuthenticationKeys struct {
	Number         types.Int64  `tfsdk:"number"`
	Md5            types.String `tfsdk:"md5"`
	CmacAes128     types.String `tfsdk:"cmac_aes_128"`
	HmacSha1       types.String `tfsdk:"hmac_sha1"`
	HmacSha2256    types.String `tfsdk:"hmac_sha2_256"`
	Sha1           types.String `tfsdk:"sha1"`
	Sha2           types.String `tfsdk:"sha2"`
	EncryptionType types.Int64  `tfsdk:"encryption_type"`
}
type NTPServers struct {
	IpAddress types.String `tfsdk:"ip_address"`
	Source    types.String `tfsdk:"source"`
	Key       types.Int64  `tfsdk:"key"`
	Prefer    types.Bool   `tfsdk:"prefer"`
	Version   types.Int64  `tfsdk:"version"`
	Burst     types.Bool   `tfsdk:"burst"`
	Iburst    types.Bool   `tfsdk:"iburst"`
	Periodic  types.Bool   `tfsdk:"periodic"`
}
type NTPServerVrfs struct {
	Name    types.String           `tfsdk:"name"`
	Servers []NTPServerVrfsServers `tfsdk:"servers"`
}
type NTPPeers struct {
	IpAddress types.String `tfsdk:"ip_address"`
	Source    types.String `tfsdk:"source"`
	Key       types.Int64  `tfsdk:"key"`
	Prefer    types.Bool   `tfsdk:"prefer"`
	Version   types.Int64  `tfsdk:"version"`
}
type NTPPeerVrfs struct {
	Name  types.String       `tfsdk:"name"`
	Peers []NTPPeerVrfsPeers `tfsdk:"peers"`
}
type NTPTrustedKeys struct {
	Number types.Int64 `tfsdk:"number"`
}
type NTPServerVrfsServers struct {
	IpAddress types.String `tfsdk:"ip_address"`
	Key       types.Int64  `tfsdk:"key"`
	Prefer    types.Bool   `tfsdk:"prefer"`
	Version   types.Int64  `tfsdk:"version"`
	Burst     types.Bool   `tfsdk:"burst"`
	Iburst    types.Bool   `tfsdk:"iburst"`
	Periodic  types.Bool   `tfsdk:"periodic"`
}
type NTPPeerVrfsPeers struct {
	IpAddress types.String `tfsdk:"ip_address"`
	Key       types.Int64  `tfsdk:"key"`
	Prefer    types.Bool   `tfsdk:"prefer"`
	Version   types.Int64  `tfsdk:"version"`
}

// End of section. //template:end types

// Section below is generated&owned by "gen/generator.go". //template:begin getPath

func (data NTP) getPath() string {
	return "Cisco-IOS-XE-native:native/ntp"
}

func (data NTPData) getPath() string {
	return "Cisco-IOS-XE-native:native/ntp"
}

// if last path element has a key -> remove it
func (data NTP) getPathShort() string {
	path := data.getPath()
	re := regexp.MustCompile(`(.*)=[^\/]*$`)
	matches := re.FindStringSubmatch(path)
	if len(matches) <= 1 {
		return path
	}
	return matches[1]
}

// End of section. //template:end getPath

// Section below is generated&owned by "gen/generator.go". //template:begin toBody

func (data NTP) toBody(ctx context.Context) string {
	body := `{"` + helpers.LastElement(data.getPath()) + `":{}}`
	if !data.Authenticate.IsNull() && !data.Authenticate.IsUnknown() {
		if data.Authenticate.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authenticate", map[string]string{})
		}
	}
	if !data.Logging.IsNull() && !data.Logging.IsUnknown() {
		if data.Logging.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:logging", map[string]string{})
		}
	}
	if !data.AccessGroupPeerAcl.IsNull() && !data.AccessGroupPeerAcl.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:access-group.peer.acl", data.AccessGroupPeerAcl.ValueString())
	}
	if !data.AccessGroupQueryOnlyAcl.IsNull() && !data.AccessGroupQueryOnlyAcl.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:access-group.query-only.acl", data.AccessGroupQueryOnlyAcl.ValueString())
	}
	if !data.AccessGroupServeAcl.IsNull() && !data.AccessGroupServeAcl.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:access-group.serve.acl", data.AccessGroupServeAcl.ValueString())
	}
	if !data.AccessGroupServeOnlyAcl.IsNull() && !data.AccessGroupServeOnlyAcl.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:access-group.serve-only.acl", data.AccessGroupServeOnlyAcl.ValueString())
	}
	if !data.ClockPeriod.IsNull() && !data.ClockPeriod.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:clock-period", strconv.FormatInt(data.ClockPeriod.ValueInt64(), 10))
	}
	if !data.Master.IsNull() && !data.Master.IsUnknown() {
		if data.Master.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:master", map[string]string{})
		}
	}
	if !data.MasterStratum.IsNull() && !data.MasterStratum.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:master.stratum-number", strconv.FormatInt(data.MasterStratum.ValueInt64(), 10))
	}
	if !data.Passive.IsNull() && !data.Passive.IsUnknown() {
		if data.Passive.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:passive", map[string]string{})
		}
	}
	if !data.UpdateCalendar.IsNull() && !data.UpdateCalendar.IsUnknown() {
		if data.UpdateCalendar.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:update-calendar", map[string]string{})
		}
	}
	if !data.SourceGigabitEthernet.IsNull() && !data.SourceGigabitEthernet.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.GigabitEthernet", data.SourceGigabitEthernet.ValueString())
	}
	if !data.SourceTenGigabitEthernet.IsNull() && !data.SourceTenGigabitEthernet.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.TenGigabitEthernet", data.SourceTenGigabitEthernet.ValueString())
	}
	if !data.SourceFortyGigabitEthernet.IsNull() && !data.SourceFortyGigabitEthernet.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.FortyGigabitEthernet", data.SourceFortyGigabitEthernet.ValueString())
	}
	if !data.SourceHundredGigabitEthernet.IsNull() && !data.SourceHundredGigabitEthernet.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.HundredGigE", data.SourceHundredGigabitEthernet.ValueString())
	}
	if !data.SourceLoopback.IsNull() && !data.SourceLoopback.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.Loopback", strconv.FormatInt(data.SourceLoopback.ValueInt64(), 10))
	}
	if !data.SourcePortChannel.IsNull() && !data.SourcePortChannel.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.Port-channel", strconv.FormatInt(data.SourcePortChannel.ValueInt64(), 10))
	}
	if !data.SourcePortChannelSubinterface.IsNull() && !data.SourcePortChannelSubinterface.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.Port-channel-subinterface.Port-channel", data.SourcePortChannelSubinterface.ValueString())
	}
	if !data.SourceVlan.IsNull() && !data.SourceVlan.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:source.Vlan", strconv.FormatInt(data.SourceVlan.ValueInt64(), 10))
	}
	if len(data.AuthenticationKeys) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key", []interface{}{})
		for index, item := range data.AuthenticationKeys {
			if !item.Number.IsNull() && !item.Number.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"number", strconv.FormatInt(item.Number.ValueInt64(), 10))
			}
			if !item.Md5.IsNull() && !item.Md5.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"md5-cfg", item.Md5.ValueString())
			}
			if !item.CmacAes128.IsNull() && !item.CmacAes128.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"cmac-aes-128", item.CmacAes128.ValueString())
			}
			if !item.HmacSha1.IsNull() && !item.HmacSha1.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"hmac-sha1", item.HmacSha1.ValueString())
			}
			if !item.HmacSha2256.IsNull() && !item.HmacSha2256.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"hmac-sha2-256", item.HmacSha2256.ValueString())
			}
			if !item.Sha1.IsNull() && !item.Sha1.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"sha1", item.Sha1.ValueString())
			}
			if !item.Sha2.IsNull() && !item.Sha2.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"sha2", item.Sha2.ValueString())
			}
			if !item.EncryptionType.IsNull() && !item.EncryptionType.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:authentication-key"+"."+strconv.Itoa(index)+"."+"encryption-type", strconv.FormatInt(item.EncryptionType.ValueInt64(), 10))
			}
		}
	}
	if len(data.Servers) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list", []interface{}{})
		for index, item := range data.Servers {
			if !item.IpAddress.IsNull() && !item.IpAddress.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"ip-address", item.IpAddress.ValueString())
			}
			if !item.Source.IsNull() && !item.Source.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"source", item.Source.ValueString())
			}
			if !item.Key.IsNull() && !item.Key.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"key", strconv.FormatInt(item.Key.ValueInt64(), 10))
			}
			if !item.Prefer.IsNull() && !item.Prefer.IsUnknown() {
				if item.Prefer.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"prefer", map[string]string{})
				}
			}
			if !item.Version.IsNull() && !item.Version.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"version", strconv.FormatInt(item.Version.ValueInt64(), 10))
			}
			if !item.Burst.IsNull() && !item.Burst.IsUnknown() {
				if item.Burst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"burst-opt", map[string]string{})
				}
			}
			if !item.Iburst.IsNull() && !item.Iburst.IsUnknown() {
				if item.Iburst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"iburst-opt", map[string]string{})
				}
			}
			if !item.Periodic.IsNull() && !item.Periodic.IsUnknown() {
				if item.Periodic.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.server-list"+"."+strconv.Itoa(index)+"."+"periodic", map[string]string{})
				}
			}
		}
	}
	if len(data.ServerVrfs) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf", []interface{}{})
		for index, item := range data.ServerVrfs {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
			if len(item.Servers) > 0 {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list", []interface{}{})
				for cindex, citem := range item.Servers {
					if !citem.IpAddress.IsNull() && !citem.IpAddress.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"ip-address", citem.IpAddress.ValueString())
					}
					if !citem.Key.IsNull() && !citem.Key.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"key", strconv.FormatInt(citem.Key.ValueInt64(), 10))
					}
					if !citem.Prefer.IsNull() && !citem.Prefer.IsUnknown() {
						if citem.Prefer.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"prefer", map[string]string{})
						}
					}
					if !citem.Version.IsNull() && !citem.Version.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"version", strconv.FormatInt(citem.Version.ValueInt64(), 10))
					}
					if !citem.Burst.IsNull() && !citem.Burst.IsUnknown() {
						if citem.Burst.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"burst-opt", map[string]string{})
						}
					}
					if !citem.Iburst.IsNull() && !citem.Iburst.IsUnknown() {
						if citem.Iburst.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"iburst-opt", map[string]string{})
						}
					}
					if !citem.Periodic.IsNull() && !citem.Periodic.IsUnknown() {
						if citem.Periodic.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:server.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"periodic", map[string]string{})
						}
					}
				}
			}
		}
	}
	if len(data.Peers) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.server-list", []interface{}{})
		for index, item := range data.Peers {
			if !item.IpAddress.IsNull() && !item.IpAddress.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.server-list"+"."+strconv.Itoa(index)+"."+"ip-address", item.IpAddress.ValueString())
			}
			if !item.Source.IsNull() && !item.Source.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.server-list"+"."+strconv.Itoa(index)+"."+"source", item.Source.ValueString())
			}
			if !item.Key.IsNull() && !item.Key.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.server-list"+"."+strconv.Itoa(index)+"."+"key", strconv.FormatInt(item.Key.ValueInt64(), 10))
			}
			if !item.Prefer.IsNull() && !item.Prefer.IsUnknown() {
				if item.Prefer.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.server-list"+"."+strconv.Itoa(index)+"."+"prefer", map[string]string{})
				}
			}
			if !item.Version.IsNull() && !item.Version.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.server-list"+"."+strconv.Itoa(index)+"."+"version", strconv.FormatInt(item.Version.ValueInt64(), 10))
			}
		}
	}
	if len(data.PeerVrfs) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf", []interface{}{})
		for index, item := range data.PeerVrfs {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
			if len(item.Peers) > 0 {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf"+"."+strconv.Itoa(index)+"."+"server-list", []interface{}{})
				for cindex, citem := range item.Peers {
					if !citem.IpAddress.IsNull() && !citem.IpAddress.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"ip-address", citem.IpAddress.ValueString())
					}
					if !citem.Key.IsNull() && !citem.Key.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"key", strconv.FormatInt(citem.Key.ValueInt64(), 10))
					}
					if !citem.Prefer.IsNull() && !citem.Prefer.IsUnknown() {
						if citem.Prefer.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"prefer", map[string]string{})
						}
					}
					if !citem.Version.IsNull() && !citem.Version.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:peer.vrf"+"."+strconv.Itoa(index)+"."+"server-list"+"."+strconv.Itoa(cindex)+"."+"version", strconv.FormatInt(citem.Version.ValueInt64(), 10))
					}
				}
			}
		}
	}
	if len(data.TrustedKeys) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:trusted-key", []interface{}{})
		for index, item := range data.TrustedKeys {
			if !item.Number.IsNull() && !item.Number.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ntp:trusted-key"+"."+strconv.Itoa(index)+"."+"number", strconv.FormatInt(item.Number.ValueInt64(), 10))
			}
		}
	}
	return body
}

// End of section. //template:end toBody

// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody

func (data *NTP) updateFromBody(ctx context.Context, res gjson.Result) {
	prefix := helpers.LastElement(data.getPath()) + "."
	if res.Get(helpers.LastElement(data.getPath())).IsArray() {
		prefix += "0."
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:authenticate"); !data.Authenticate.IsNull() {
		if value.Exists() {
			data.Authenticate = types.BoolValue(true)
		} else {
			data.Authenticate = types.BoolValue(false)
		}
	} else {
		data.Authenticate = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:logging"); !data.Logging.IsNull() {
		if value.Exists() {
			data.Logging = types.BoolValue(true)
		} else {
			data.Logging = types.BoolValue(false)
		}
	} else {
		data.Logging = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.peer.acl"); value.Exists() && !data.AccessGroupPeerAcl.IsNull() {
		data.AccessGroupPeerAcl = types.StringValue(value.String())
	} else {
		data.AccessGroupPeerAcl = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.query-only.acl"); value.Exists() && !data.AccessGroupQueryOnlyAcl.IsNull() {
		data.AccessGroupQueryOnlyAcl = types.StringValue(value.String())
	} else {
		data.AccessGroupQueryOnlyAcl = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.serve.acl"); value.Exists() && !data.AccessGroupServeAcl.IsNull() {
		data.AccessGroupServeAcl = types.StringValue(value.String())
	} else {
		data.AccessGroupServeAcl = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.serve-only.acl"); value.Exists() && !data.AccessGroupServeOnlyAcl.IsNull() {
		data.AccessGroupServeOnlyAcl = types.StringValue(value.String())
	} else {
		data.AccessGroupServeOnlyAcl = types.StringNull()
	}
	for i := range data.AuthenticationKeys {
		keys := [...]string{"number"}
		keyValues := [...]string{strconv.FormatInt(data.AuthenticationKeys[i].Number.ValueInt64(), 10)}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-ntp:authentication-key").ForEach(
			func(_, v gjson.Result) bool {
				found := false
				for ik := range keys {
					if v.Get(keys[ik]).String() == keyValues[ik] {
						found = true
						continue
					}
					found = false
					break
				}
				if found {
					r = v
					return false
				}
				return true
			},
		)
		if value := r.Get("number"); value.Exists() && !data.AuthenticationKeys[i].Number.IsNull() {
			data.AuthenticationKeys[i].Number = types.Int64Value(value.Int())
		} else {
			data.AuthenticationKeys[i].Number = types.Int64Null()
		}
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:clock-period"); value.Exists() && !data.ClockPeriod.IsNull() {
		data.ClockPeriod = types.Int64Value(value.Int())
	} else {
		data.ClockPeriod = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:master"); !data.Master.IsNull() {
		if value.Exists() {
			data.Master = types.BoolValue(true)
		} else {
			data.Master = types.BoolValue(false)
		}
	} else {
		data.Master = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:master.stratum-number"); value.Exists() && !data.MasterStratum.IsNull() {
		data.MasterStratum = types.Int64Value(value.Int())
	} else {
		data.MasterStratum = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:passive"); !data.Passive.IsNull() {
		if value.Exists() {
			data.Passive = types.BoolValue(true)
		} else {
			data.Passive = types.BoolValue(false)
		}
	} else {
		data.Passive = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:update-calendar"); !data.UpdateCalendar.IsNull() {
		if value.Exists() {
			data.UpdateCalendar = types.BoolValue(true)
		} else {
			data.UpdateCalendar = types.BoolValue(false)
		}
	} else {
		data.UpdateCalendar = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.GigabitEthernet"); value.Exists() && !data.SourceGigabitEthernet.IsNull() {
		data.SourceGigabitEthernet = types.StringValue(value.String())
	} else {
		data.SourceGigabitEthernet = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.TenGigabitEthernet"); value.Exists() && !data.SourceTenGigabitEthernet.IsNull() {
		data.SourceTenGigabitEthernet = types.StringValue(value.String())
	} else {
		data.SourceTenGigabitEthernet = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.FortyGigabitEthernet"); value.Exists() && !data.SourceFortyGigabitEthernet.IsNull() {
		data.SourceFortyGigabitEthernet = types.StringValue(value.String())
	} else {
		data.SourceFortyGigabitEthernet = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.HundredGigE"); value.Exists() && !data.SourceHundredGigabitEthernet.IsNull() {
		data.SourceHundredGigabitEthernet = types.StringValue(value.String())
	} else {
		data.SourceHundredGigabitEthernet = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Loopback"); value.Exists() && !data.SourceLoopback.IsNull() {
		data.SourceLoopback = types.Int64Value(value.Int())
	} else {
		data.SourceLoopback = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Port-channel"); value.Exists() && !data.SourcePortChannel.IsNull() {
		data.SourcePortChannel = types.Int64Value(value.Int())
	} else {
		data.SourcePortChannel = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Port-channel-subinterface.Port-channel"); value.Exists() && !data.SourcePortChannelSubinterface.IsNull() {
		data.SourcePortChannelSubinterface = types.StringValue(value.String())
	} else {
		data.SourcePortChannelSubinterface = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Vlan"); value.Exists() && !data.SourceVlan.IsNull() {
		data.SourceVlan = types.Int64Value(value.Int())
	} else {
		data.SourceVlan = types.Int64Null()
	}
	for i := range data.Servers {
		keys := [...]string{"ip-address"}
		keyValues := [...]string{data.Servers[i].IpAddress.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-ntp:server.server-list").ForEach(
			func(_, v gjson.Result) bool {
				found := false
				for ik := range keys {
					if v.Get(keys[ik]).String() == keyValues[ik] {
						found = true
						continue
					}
					found = false
					break
				}
				if found {
					r = v
					return false
				}
				return true
			},
		)
		if value := r.Get("ip-address"); value.Exists() && !data.Servers[i].IpAddress.IsNull() {
			data.Servers[i].IpAddress = types.StringValue(value.String())
		} else {
			data.Servers[i].IpAddress = types.StringNull()
		}
		if value := r.Get("source"); value.Exists() && !data.Servers[i].Source.IsNull() {
			data.Servers[i].Source = types.StringValue(value.String())
		} else {
			data.Servers[i].Source = types.StringNull()
		}
		if value := r.Get("key"); value.Exists() && !data.Servers[i].Key.IsNull() {
			data.Servers[i].Key = types.Int64Value(value.Int())
		} else {
			data.Servers[i].Key = types.Int64Null()
		}
		if value := r.Get("prefer"); !data.Servers[i].Prefer.IsNull() {
			if value.Exists() {
				data.Servers[i].Prefer = types.BoolValue(true)
			} else {
				data.Servers[i].Prefer = types.BoolValue(false)
			}
		} else {
			data.Servers[i].Prefer = types.BoolNull()
		}
		if value := r.Get("version"); value.Exists() && !data.Servers[i].Version.IsNull() {
			data.Servers[i].Version = types.Int64Value(value.Int())
		} else {
			data.Servers[i].Version = types.Int64Null()
		}
		if value := r.Get("burst-opt"); !data.Servers[i].Burst.IsNull() {
			if value.Exists() {
				data.Servers[i].Burst = types.BoolValue(true)
			} else {
				data.Servers[i].Burst = types.BoolValue(false)
			}
		} else {
			data.Servers[i].Burst = types.BoolNull()
		}
		if value := r.Get("iburst-opt"); !data.Servers[i].Iburst.IsNull() {
			if value.Exists() {
				data.Servers[i].Iburst = types.BoolValue(true)
			} else {
				data.Servers[i].Iburst = types.BoolValue(false)
			}
		} else {
			data.Servers[i].Iburst = types.BoolNull()
		}
		if value := r.Get("periodic"); !data.Servers[i].Periodic.IsNull() {
			if value.Exists() {
				data.Servers[i].Periodic = types.BoolValue(true)
			} else {
				data.Servers[i].Periodic = types.BoolValue(false)
			}
		} else {
			data.Servers[i].Periodic = types.BoolNull()
		}
	}
	for i := range data.ServerVrfs {
		keys := [...]string{"name"}
		keyValues := [...]string{data.ServerVrfs[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-ntp:server.vrf").ForEach(
			func(_, v gjson.Result) bool {
				found := false
				for ik := range keys {
					if v.Get(keys[ik]).String() == keyValues[ik] {
						found = true
						continue
					}
					found = false
					break
				}
				if found {
					r = v
					return false
				}
				return true
			},
		)
		if value := r.Get("name"); value.Exists() && !data.ServerVrfs[i].Name.IsNull() {
			data.ServerVrfs[i].Name = types.StringValue(value.String())
		} else {
			data.ServerVrfs[i].Name = types.StringNull()
		}
		for ci := range data.ServerVrfs[i].Servers {
			keys := [...]string{"ip-address"}
			keyValues := [...]string{data.ServerVrfs[i].Servers[ci].IpAddress.ValueString()}

			var cr gjson.Result
			r.Get("server-list").ForEach(
				func(_, v gjson.Result) bool {
					found := false
					for ik := range keys {
						if v.Get(keys[ik]).String() == keyValues[ik] {
							found = true
							continue
						}
						found = false
						break
					}
					if found {
						cr = v
						return false
					}
					return true
				},
			)
			if value := cr.Get("ip-address"); value.Exists() && !data.ServerVrfs[i].Servers[ci].IpAddress.IsNull() {
				data.ServerVrfs[i].Servers[ci].IpAddress = types.StringValue(value.String())
			} else {
				data.ServerVrfs[i].Servers[ci].IpAddress = types.StringNull()
			}
			if value := cr.Get("key"); value.Exists() && !data.ServerVrfs[i].Servers[ci].Key.IsNull() {
				data.ServerVrfs[i].Servers[ci].Key = types.Int64Value(value.Int())
			} else {
				data.ServerVrfs[i].Servers[ci].Key = types.Int64Null()
			}
			if value := cr.Get("prefer"); !data.ServerVrfs[i].Servers[ci].Prefer.IsNull() {
				if value.Exists() {
					data.ServerVrfs[i].Servers[ci].Prefer = types.BoolValue(true)
				} else {
					data.ServerVrfs[i].Servers[ci].Prefer = types.BoolValue(false)
				}
			} else {
				data.ServerVrfs[i].Servers[ci].Prefer = types.BoolNull()
			}
			if value := cr.Get("version"); value.Exists() && !data.ServerVrfs[i].Servers[ci].Version.IsNull() {
				data.ServerVrfs[i].Servers[ci].Version = types.Int64Value(value.Int())
			} else {
				data.ServerVrfs[i].Servers[ci].Version = types.Int64Null()
			}
			if value := cr.Get("burst-opt"); !data.ServerVrfs[i].Servers[ci].Burst.IsNull() {
				if value.Exists() {
					data.ServerVrfs[i].Servers[ci].Burst = types.BoolValue(true)
				} else {
					data.ServerVrfs[i].Servers[ci].Burst = types.BoolValue(false)
				}
			} else {
				data.ServerVrfs[i].Servers[ci].Burst = types.BoolNull()
			}
			if value := cr.Get("iburst-opt"); !data.ServerVrfs[i].Servers[ci].Iburst.IsNull() {
				if value.Exists() {
					data.ServerVrfs[i].Servers[ci].Iburst = types.BoolValue(true)
				} else {
					data.ServerVrfs[i].Servers[ci].Iburst = types.BoolValue(false)
				}
			} else {
				data.ServerVrfs[i].Servers[ci].Iburst = types.BoolNull()
			}
			if value := cr.Get("periodic"); !data.ServerVrfs[i].Servers[ci].Periodic.IsNull() {
				if value.Exists() {
					data.ServerVrfs[i].Servers[ci].Periodic = types.BoolValue(true)
				} else {
					data.ServerVrfs[i].Servers[ci].Periodic = types.BoolValue(false)
				}
			} else {
				data.ServerVrfs[i].Servers[ci].Periodic = types.BoolNull()
			}
		}
	}
	for i := range data.Peers {
		keys := [...]string{"ip-address"}
		keyValues := [...]string{data.Peers[i].IpAddress.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-ntp:peer.server-list").ForEach(
			func(_, v gjson.Result) bool {
				found := false
				for ik := range keys {
					if v.Get(keys[ik]).String() == keyValues[ik] {
						found = true
						continue
					}
					found = false
					break
				}
				if found {
					r = v
					return false
				}
				return true
			},
		)
		if value := r.Get("ip-address"); value.Exists() && !data.Peers[i].IpAddress.IsNull() {
			data.Peers[i].IpAddress = types.StringValue(value.String())
		} else {
			data.Peers[i].IpAddress = types.StringNull()
		}
		if value := r.Get("source"); value.Exists() && !data.Peers[i].Source.IsNull() {
			data.Peers[i].Source = types.StringValue(value.String())
		} else {
			data.Peers[i].Source = types.StringNull()
		}
		if value := r.Get("key"); value.Exists() && !data.Peers[i].Key.IsNull() {
			data.Peers[i].Key = types.Int64Value(value.Int())
		} else {
			data.Peers[i].Key = types.Int64Null()
		}
		if value := r.Get("prefer"); !data.Peers[i].Prefer.IsNull() {
			if value.Exists() {
				data.Peers[i].Prefer = types.BoolValue(true)
			} else {
				data.Peers[i].Prefer = types.BoolValue(false)
			}
		} else {
			data.Peers[i].Prefer = types.BoolNull()
		}
		if value := r.Get("version"); value.Exists() && !data.Peers[i].Version.IsNull() {
			data.Peers[i].Version = types.Int64Value(value.Int())
		} else {
			data.Peers[i].Version = types.Int64Null()
		}
	}
	for i := range data.PeerVrfs {
		keys := [...]string{"name"}
		keyValues := [...]string{data.PeerVrfs[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-ntp:peer.vrf").ForEach(
			func(_, v gjson.Result) bool {
				found := false
				for ik := range keys {
					if v.Get(keys[ik]).String() == keyValues[ik] {
						found = true
						continue
					}
					found = false
					break
				}
				if found {
					r = v
					return false
				}
				return true
			},
		)
		if value := r.Get("name"); value.Exists() && !data.PeerVrfs[i].Name.IsNull() {
			data.PeerVrfs[i].Name = types.StringValue(value.String())
		} else {
			data.PeerVrfs[i].Name = types.StringNull()
		}
		for ci := range data.PeerVrfs[i].Peers {
			keys := [...]string{"ip-address"}
			keyValues := [...]string{data.PeerVrfs[i].Peers[ci].IpAddress.ValueString()}

			var cr gjson.Result
			r.Get("server-list").ForEach(
				func(_, v gjson.Result) bool {
					found := false
					for ik := range keys {
						if v.Get(keys[ik]).String() == keyValues[ik] {
							found = true
							continue
						}
						found = false
						break
					}
					if found {
						cr = v
						return false
					}
					return true
				},
			)
			if value := cr.Get("ip-address"); value.Exists() && !data.PeerVrfs[i].Peers[ci].IpAddress.IsNull() {
				data.PeerVrfs[i].Peers[ci].IpAddress = types.StringValue(value.String())
			} else {
				data.PeerVrfs[i].Peers[ci].IpAddress = types.StringNull()
			}
			if value := cr.Get("key"); value.Exists() && !data.PeerVrfs[i].Peers[ci].Key.IsNull() {
				data.PeerVrfs[i].Peers[ci].Key = types.Int64Value(value.Int())
			} else {
				data.PeerVrfs[i].Peers[ci].Key = types.Int64Null()
			}
			if value := cr.Get("prefer"); !data.PeerVrfs[i].Peers[ci].Prefer.IsNull() {
				if value.Exists() {
					data.PeerVrfs[i].Peers[ci].Prefer = types.BoolValue(true)
				} else {
					data.PeerVrfs[i].Peers[ci].Prefer = types.BoolValue(false)
				}
			} else {
				data.PeerVrfs[i].Peers[ci].Prefer = types.BoolNull()
			}
			if value := cr.Get("version"); value.Exists() && !data.PeerVrfs[i].Peers[ci].Version.IsNull() {
				data.PeerVrfs[i].Peers[ci].Version = types.Int64Value(value.Int())
			} else {
				data.PeerVrfs[i].Peers[ci].Version = types.Int64Null()
			}
		}
	}
	for i := range data.TrustedKeys {
		keys := [...]string{"number"}
		keyValues := [...]string{strconv.FormatInt(data.TrustedKeys[i].Number.ValueInt64(), 10)}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-ntp:trusted-key").ForEach(
			func(_, v gjson.Result) bool {
				found := false
				for ik := range keys {
					if v.Get(keys[ik]).String() == keyValues[ik] {
						found = true
						continue
					}
					found = false
					break
				}
				if found {
					r = v
					return false
				}
				return true
			},
		)
		if value := r.Get("number"); value.Exists() && !data.TrustedKeys[i].Number.IsNull() {
			data.TrustedKeys[i].Number = types.Int64Value(value.Int())
		} else {
			data.TrustedKeys[i].Number = types.Int64Null()
		}
	}
}

// End of section. //template:end updateFromBody

// Section below is generated&owned by "gen/generator.go". //template:begin fromBody

func (data *NTP) fromBody(ctx context.Context, res gjson.Result) {
	prefix := helpers.LastElement(data.getPath()) + "."
	if res.Get(helpers.LastElement(data.getPath())).IsArray() {
		prefix += "0."
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:authenticate"); value.Exists() {
		data.Authenticate = types.BoolValue(true)
	} else {
		data.Authenticate = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:logging"); value.Exists() {
		data.Logging = types.BoolValue(true)
	} else {
		data.Logging = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.peer.acl"); value.Exists() {
		data.AccessGroupPeerAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.query-only.acl"); value.Exists() {
		data.AccessGroupQueryOnlyAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.serve.acl"); value.Exists() {
		data.AccessGroupServeAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.serve-only.acl"); value.Exists() {
		data.AccessGroupServeOnlyAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:authentication-key"); value.Exists() {
		data.AuthenticationKeys = make([]NTPAuthenticationKeys, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPAuthenticationKeys{}
			if cValue := v.Get("number"); cValue.Exists() {
				item.Number = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("md5-cfg"); cValue.Exists() {
				item.Md5 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("cmac-aes-128"); cValue.Exists() {
				item.CmacAes128 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("hmac-sha1"); cValue.Exists() {
				item.HmacSha1 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("hmac-sha2-256"); cValue.Exists() {
				item.HmacSha2256 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("sha1"); cValue.Exists() {
				item.Sha1 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("sha2"); cValue.Exists() {
				item.Sha2 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("encryption-type"); cValue.Exists() {
				item.EncryptionType = types.Int64Value(cValue.Int())
			}
			data.AuthenticationKeys = append(data.AuthenticationKeys, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:clock-period"); value.Exists() {
		data.ClockPeriod = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:master"); value.Exists() {
		data.Master = types.BoolValue(true)
	} else {
		data.Master = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:master.stratum-number"); value.Exists() {
		data.MasterStratum = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:passive"); value.Exists() {
		data.Passive = types.BoolValue(true)
	} else {
		data.Passive = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:update-calendar"); value.Exists() {
		data.UpdateCalendar = types.BoolValue(true)
	} else {
		data.UpdateCalendar = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.GigabitEthernet"); value.Exists() {
		data.SourceGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.TenGigabitEthernet"); value.Exists() {
		data.SourceTenGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.FortyGigabitEthernet"); value.Exists() {
		data.SourceFortyGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.HundredGigE"); value.Exists() {
		data.SourceHundredGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Loopback"); value.Exists() {
		data.SourceLoopback = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Port-channel"); value.Exists() {
		data.SourcePortChannel = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Port-channel-subinterface.Port-channel"); value.Exists() {
		data.SourcePortChannelSubinterface = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Vlan"); value.Exists() {
		data.SourceVlan = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:server.server-list"); value.Exists() {
		data.Servers = make([]NTPServers, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPServers{}
			if cValue := v.Get("ip-address"); cValue.Exists() {
				item.IpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("source"); cValue.Exists() {
				item.Source = types.StringValue(cValue.String())
			}
			if cValue := v.Get("key"); cValue.Exists() {
				item.Key = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("prefer"); cValue.Exists() {
				item.Prefer = types.BoolValue(true)
			} else {
				item.Prefer = types.BoolValue(false)
			}
			if cValue := v.Get("version"); cValue.Exists() {
				item.Version = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("burst-opt"); cValue.Exists() {
				item.Burst = types.BoolValue(true)
			} else {
				item.Burst = types.BoolValue(false)
			}
			if cValue := v.Get("iburst-opt"); cValue.Exists() {
				item.Iburst = types.BoolValue(true)
			} else {
				item.Iburst = types.BoolValue(false)
			}
			if cValue := v.Get("periodic"); cValue.Exists() {
				item.Periodic = types.BoolValue(true)
			} else {
				item.Periodic = types.BoolValue(false)
			}
			data.Servers = append(data.Servers, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:server.vrf"); value.Exists() {
		data.ServerVrfs = make([]NTPServerVrfs, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPServerVrfs{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("server-list"); cValue.Exists() {
				item.Servers = make([]NTPServerVrfsServers, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := NTPServerVrfsServers{}
					if ccValue := cv.Get("ip-address"); ccValue.Exists() {
						cItem.IpAddress = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("key"); ccValue.Exists() {
						cItem.Key = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("prefer"); ccValue.Exists() {
						cItem.Prefer = types.BoolValue(true)
					} else {
						cItem.Prefer = types.BoolValue(false)
					}
					if ccValue := cv.Get("version"); ccValue.Exists() {
						cItem.Version = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("burst-opt"); ccValue.Exists() {
						cItem.Burst = types.BoolValue(true)
					} else {
						cItem.Burst = types.BoolValue(false)
					}
					if ccValue := cv.Get("iburst-opt"); ccValue.Exists() {
						cItem.Iburst = types.BoolValue(true)
					} else {
						cItem.Iburst = types.BoolValue(false)
					}
					if ccValue := cv.Get("periodic"); ccValue.Exists() {
						cItem.Periodic = types.BoolValue(true)
					} else {
						cItem.Periodic = types.BoolValue(false)
					}
					item.Servers = append(item.Servers, cItem)
					return true
				})
			}
			data.ServerVrfs = append(data.ServerVrfs, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:peer.server-list"); value.Exists() {
		data.Peers = make([]NTPPeers, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPPeers{}
			if cValue := v.Get("ip-address"); cValue.Exists() {
				item.IpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("source"); cValue.Exists() {
				item.Source = types.StringValue(cValue.String())
			}
			if cValue := v.Get("key"); cValue.Exists() {
				item.Key = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("prefer"); cValue.Exists() {
				item.Prefer = types.BoolValue(true)
			} else {
				item.Prefer = types.BoolValue(false)
			}
			if cValue := v.Get("version"); cValue.Exists() {
				item.Version = types.Int64Value(cValue.Int())
			}
			data.Peers = append(data.Peers, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:peer.vrf"); value.Exists() {
		data.PeerVrfs = make([]NTPPeerVrfs, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPPeerVrfs{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("server-list"); cValue.Exists() {
				item.Peers = make([]NTPPeerVrfsPeers, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := NTPPeerVrfsPeers{}
					if ccValue := cv.Get("ip-address"); ccValue.Exists() {
						cItem.IpAddress = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("key"); ccValue.Exists() {
						cItem.Key = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("prefer"); ccValue.Exists() {
						cItem.Prefer = types.BoolValue(true)
					} else {
						cItem.Prefer = types.BoolValue(false)
					}
					if ccValue := cv.Get("version"); ccValue.Exists() {
						cItem.Version = types.Int64Value(ccValue.Int())
					}
					item.Peers = append(item.Peers, cItem)
					return true
				})
			}
			data.PeerVrfs = append(data.PeerVrfs, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:trusted-key"); value.Exists() {
		data.TrustedKeys = make([]NTPTrustedKeys, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPTrustedKeys{}
			if cValue := v.Get("number"); cValue.Exists() {
				item.Number = types.Int64Value(cValue.Int())
			}
			data.TrustedKeys = append(data.TrustedKeys, item)
			return true
		})
	}
}

// End of section. //template:end fromBody

// Section below is generated&owned by "gen/generator.go". //template:begin fromBodyData

func (data *NTPData) fromBody(ctx context.Context, res gjson.Result) {
	prefix := helpers.LastElement(data.getPath()) + "."
	if res.Get(helpers.LastElement(data.getPath())).IsArray() {
		prefix += "0."
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:authenticate"); value.Exists() {
		data.Authenticate = types.BoolValue(true)
	} else {
		data.Authenticate = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:logging"); value.Exists() {
		data.Logging = types.BoolValue(true)
	} else {
		data.Logging = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.peer.acl"); value.Exists() {
		data.AccessGroupPeerAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.query-only.acl"); value.Exists() {
		data.AccessGroupQueryOnlyAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.serve.acl"); value.Exists() {
		data.AccessGroupServeAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:access-group.serve-only.acl"); value.Exists() {
		data.AccessGroupServeOnlyAcl = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:authentication-key"); value.Exists() {
		data.AuthenticationKeys = make([]NTPAuthenticationKeys, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPAuthenticationKeys{}
			if cValue := v.Get("number"); cValue.Exists() {
				item.Number = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("md5-cfg"); cValue.Exists() {
				item.Md5 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("cmac-aes-128"); cValue.Exists() {
				item.CmacAes128 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("hmac-sha1"); cValue.Exists() {
				item.HmacSha1 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("hmac-sha2-256"); cValue.Exists() {
				item.HmacSha2256 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("sha1"); cValue.Exists() {
				item.Sha1 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("sha2"); cValue.Exists() {
				item.Sha2 = types.StringValue(cValue.String())
			}
			if cValue := v.Get("encryption-type"); cValue.Exists() {
				item.EncryptionType = types.Int64Value(cValue.Int())
			}
			data.AuthenticationKeys = append(data.AuthenticationKeys, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:clock-period"); value.Exists() {
		data.ClockPeriod = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:master"); value.Exists() {
		data.Master = types.BoolValue(true)
	} else {
		data.Master = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:master.stratum-number"); value.Exists() {
		data.MasterStratum = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:passive"); value.Exists() {
		data.Passive = types.BoolValue(true)
	} else {
		data.Passive = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:update-calendar"); value.Exists() {
		data.UpdateCalendar = types.BoolValue(true)
	} else {
		data.UpdateCalendar = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.GigabitEthernet"); value.Exists() {
		data.SourceGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.TenGigabitEthernet"); value.Exists() {
		data.SourceTenGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.FortyGigabitEthernet"); value.Exists() {
		data.SourceFortyGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.HundredGigE"); value.Exists() {
		data.SourceHundredGigabitEthernet = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Loopback"); value.Exists() {
		data.SourceLoopback = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Port-channel"); value.Exists() {
		data.SourcePortChannel = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Port-channel-subinterface.Port-channel"); value.Exists() {
		data.SourcePortChannelSubinterface = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:source.Vlan"); value.Exists() {
		data.SourceVlan = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:server.server-list"); value.Exists() {
		data.Servers = make([]NTPServers, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPServers{}
			if cValue := v.Get("ip-address"); cValue.Exists() {
				item.IpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("source"); cValue.Exists() {
				item.Source = types.StringValue(cValue.String())
			}
			if cValue := v.Get("key"); cValue.Exists() {
				item.Key = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("prefer"); cValue.Exists() {
				item.Prefer = types.BoolValue(true)
			} else {
				item.Prefer = types.BoolValue(false)
			}
			if cValue := v.Get("version"); cValue.Exists() {
				item.Version = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("burst-opt"); cValue.Exists() {
				item.Burst = types.BoolValue(true)
			} else {
				item.Burst = types.BoolValue(false)
			}
			if cValue := v.Get("iburst-opt"); cValue.Exists() {
				item.Iburst = types.BoolValue(true)
			} else {
				item.Iburst = types.BoolValue(false)
			}
			if cValue := v.Get("periodic"); cValue.Exists() {
				item.Periodic = types.BoolValue(true)
			} else {
				item.Periodic = types.BoolValue(false)
			}
			data.Servers = append(data.Servers, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:server.vrf"); value.Exists() {
		data.ServerVrfs = make([]NTPServerVrfs, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPServerVrfs{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("server-list"); cValue.Exists() {
				item.Servers = make([]NTPServerVrfsServers, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := NTPServerVrfsServers{}
					if ccValue := cv.Get("ip-address"); ccValue.Exists() {
						cItem.IpAddress = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("key"); ccValue.Exists() {
						cItem.Key = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("prefer"); ccValue.Exists() {
						cItem.Prefer = types.BoolValue(true)
					} else {
						cItem.Prefer = types.BoolValue(false)
					}
					if ccValue := cv.Get("version"); ccValue.Exists() {
						cItem.Version = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("burst-opt"); ccValue.Exists() {
						cItem.Burst = types.BoolValue(true)
					} else {
						cItem.Burst = types.BoolValue(false)
					}
					if ccValue := cv.Get("iburst-opt"); ccValue.Exists() {
						cItem.Iburst = types.BoolValue(true)
					} else {
						cItem.Iburst = types.BoolValue(false)
					}
					if ccValue := cv.Get("periodic"); ccValue.Exists() {
						cItem.Periodic = types.BoolValue(true)
					} else {
						cItem.Periodic = types.BoolValue(false)
					}
					item.Servers = append(item.Servers, cItem)
					return true
				})
			}
			data.ServerVrfs = append(data.ServerVrfs, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:peer.server-list"); value.Exists() {
		data.Peers = make([]NTPPeers, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPPeers{}
			if cValue := v.Get("ip-address"); cValue.Exists() {
				item.IpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("source"); cValue.Exists() {
				item.Source = types.StringValue(cValue.String())
			}
			if cValue := v.Get("key"); cValue.Exists() {
				item.Key = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("prefer"); cValue.Exists() {
				item.Prefer = types.BoolValue(true)
			} else {
				item.Prefer = types.BoolValue(false)
			}
			if cValue := v.Get("version"); cValue.Exists() {
				item.Version = types.Int64Value(cValue.Int())
			}
			data.Peers = append(data.Peers, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:peer.vrf"); value.Exists() {
		data.PeerVrfs = make([]NTPPeerVrfs, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPPeerVrfs{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("server-list"); cValue.Exists() {
				item.Peers = make([]NTPPeerVrfsPeers, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := NTPPeerVrfsPeers{}
					if ccValue := cv.Get("ip-address"); ccValue.Exists() {
						cItem.IpAddress = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("key"); ccValue.Exists() {
						cItem.Key = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("prefer"); ccValue.Exists() {
						cItem.Prefer = types.BoolValue(true)
					} else {
						cItem.Prefer = types.BoolValue(false)
					}
					if ccValue := cv.Get("version"); ccValue.Exists() {
						cItem.Version = types.Int64Value(ccValue.Int())
					}
					item.Peers = append(item.Peers, cItem)
					return true
				})
			}
			data.PeerVrfs = append(data.PeerVrfs, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-ntp:trusted-key"); value.Exists() {
		data.TrustedKeys = make([]NTPTrustedKeys, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := NTPTrustedKeys{}
			if cValue := v.Get("number"); cValue.Exists() {
				item.Number = types.Int64Value(cValue.Int())
			}
			data.TrustedKeys = append(data.TrustedKeys, item)
			return true
		})
	}
}

// End of section. //template:end fromBodyData

// Section below is generated&owned by "gen/generator.go". //template:begin getDeletedItems

func (data *NTP) getDeletedItems(ctx context.Context, state NTP) []string {
	deletedItems := make([]string, 0)
	for i := range state.TrustedKeys {
		stateKeyValues := [...]string{strconv.FormatInt(state.TrustedKeys[i].Number.ValueInt64(), 10)}

		emptyKeys := true
		if !reflect.ValueOf(state.TrustedKeys[i].Number.ValueInt64()).IsZero() {
			emptyKeys = false
		}
		if emptyKeys {
			continue
		}

		found := false
		for j := range data.TrustedKeys {
			found = true
			if state.TrustedKeys[i].Number.ValueInt64() != data.TrustedKeys[j].Number.ValueInt64() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:trusted-key=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.PeerVrfs {
		stateKeyValues := [...]string{state.PeerVrfs[i].Name.ValueString()}

		emptyKeys := true
		if !reflect.ValueOf(state.PeerVrfs[i].Name.ValueString()).IsZero() {
			emptyKeys = false
		}
		if emptyKeys {
			continue
		}

		found := false
		for j := range data.PeerVrfs {
			found = true
			if state.PeerVrfs[i].Name.ValueString() != data.PeerVrfs[j].Name.ValueString() {
				found = false
			}
			if found {
				for ci := range state.PeerVrfs[i].Peers {
					cstateKeyValues := [...]string{state.PeerVrfs[i].Peers[ci].IpAddress.ValueString()}

					cemptyKeys := true
					if !reflect.ValueOf(state.PeerVrfs[i].Peers[ci].IpAddress.ValueString()).IsZero() {
						cemptyKeys = false
					}
					if cemptyKeys {
						continue
					}

					found := false
					for cj := range data.PeerVrfs[j].Peers {
						found = true
						if state.PeerVrfs[i].Peers[ci].IpAddress.ValueString() != data.PeerVrfs[j].Peers[cj].IpAddress.ValueString() {
							found = false
						}
						if found {
							if !state.PeerVrfs[i].Peers[ci].Version.IsNull() && data.PeerVrfs[j].Peers[cj].Version.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v/server-list=%v/version", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.PeerVrfs[i].Peers[ci].Prefer.IsNull() && data.PeerVrfs[j].Peers[cj].Prefer.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v/server-list=%v/prefer", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.PeerVrfs[i].Peers[ci].Key.IsNull() && data.PeerVrfs[j].Peers[cj].Key.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v/server-list=%v/key", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							break
						}
					}
					if !found {
						deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v/server-list=%v", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
					}
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.Peers {
		stateKeyValues := [...]string{state.Peers[i].IpAddress.ValueString()}

		emptyKeys := true
		if !reflect.ValueOf(state.Peers[i].IpAddress.ValueString()).IsZero() {
			emptyKeys = false
		}
		if emptyKeys {
			continue
		}

		found := false
		for j := range data.Peers {
			found = true
			if state.Peers[i].IpAddress.ValueString() != data.Peers[j].IpAddress.ValueString() {
				found = false
			}
			if found {
				if !state.Peers[i].Version.IsNull() && data.Peers[j].Version.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v/version", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Peers[i].Prefer.IsNull() && data.Peers[j].Prefer.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v/prefer", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Peers[i].Key.IsNull() && data.Peers[j].Key.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v/key", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Peers[i].Source.IsNull() && data.Peers[j].Source.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v/source", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.ServerVrfs {
		stateKeyValues := [...]string{state.ServerVrfs[i].Name.ValueString()}

		emptyKeys := true
		if !reflect.ValueOf(state.ServerVrfs[i].Name.ValueString()).IsZero() {
			emptyKeys = false
		}
		if emptyKeys {
			continue
		}

		found := false
		for j := range data.ServerVrfs {
			found = true
			if state.ServerVrfs[i].Name.ValueString() != data.ServerVrfs[j].Name.ValueString() {
				found = false
			}
			if found {
				for ci := range state.ServerVrfs[i].Servers {
					cstateKeyValues := [...]string{state.ServerVrfs[i].Servers[ci].IpAddress.ValueString()}

					cemptyKeys := true
					if !reflect.ValueOf(state.ServerVrfs[i].Servers[ci].IpAddress.ValueString()).IsZero() {
						cemptyKeys = false
					}
					if cemptyKeys {
						continue
					}

					found := false
					for cj := range data.ServerVrfs[j].Servers {
						found = true
						if state.ServerVrfs[i].Servers[ci].IpAddress.ValueString() != data.ServerVrfs[j].Servers[cj].IpAddress.ValueString() {
							found = false
						}
						if found {
							if !state.ServerVrfs[i].Servers[ci].Periodic.IsNull() && data.ServerVrfs[j].Servers[cj].Periodic.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/periodic", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.ServerVrfs[i].Servers[ci].Iburst.IsNull() && data.ServerVrfs[j].Servers[cj].Iburst.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/iburst-opt", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.ServerVrfs[i].Servers[ci].Burst.IsNull() && data.ServerVrfs[j].Servers[cj].Burst.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/burst-opt", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.ServerVrfs[i].Servers[ci].Version.IsNull() && data.ServerVrfs[j].Servers[cj].Version.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/version", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.ServerVrfs[i].Servers[ci].Prefer.IsNull() && data.ServerVrfs[j].Servers[cj].Prefer.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/prefer", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.ServerVrfs[i].Servers[ci].Key.IsNull() && data.ServerVrfs[j].Servers[cj].Key.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/key", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							break
						}
					}
					if !found {
						deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
					}
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.Servers {
		stateKeyValues := [...]string{state.Servers[i].IpAddress.ValueString()}

		emptyKeys := true
		if !reflect.ValueOf(state.Servers[i].IpAddress.ValueString()).IsZero() {
			emptyKeys = false
		}
		if emptyKeys {
			continue
		}

		found := false
		for j := range data.Servers {
			found = true
			if state.Servers[i].IpAddress.ValueString() != data.Servers[j].IpAddress.ValueString() {
				found = false
			}
			if found {
				if !state.Servers[i].Periodic.IsNull() && data.Servers[j].Periodic.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/periodic", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Servers[i].Iburst.IsNull() && data.Servers[j].Iburst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/iburst-opt", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Servers[i].Burst.IsNull() && data.Servers[j].Burst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/burst-opt", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Servers[i].Version.IsNull() && data.Servers[j].Version.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/version", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Servers[i].Prefer.IsNull() && data.Servers[j].Prefer.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/prefer", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Servers[i].Key.IsNull() && data.Servers[j].Key.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/key", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Servers[i].Source.IsNull() && data.Servers[j].Source.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/source", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	if !state.SourceVlan.IsNull() && data.SourceVlan.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Vlan", state.getPath()))
	}
	if !state.SourcePortChannelSubinterface.IsNull() && data.SourcePortChannelSubinterface.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Port-channel-subinterface/Port-channel", state.getPath()))
	}
	if !state.SourcePortChannel.IsNull() && data.SourcePortChannel.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Port-channel", state.getPath()))
	}
	if !state.SourceLoopback.IsNull() && data.SourceLoopback.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Loopback", state.getPath()))
	}
	if !state.SourceHundredGigabitEthernet.IsNull() && data.SourceHundredGigabitEthernet.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/HundredGigE", state.getPath()))
	}
	if !state.SourceFortyGigabitEthernet.IsNull() && data.SourceFortyGigabitEthernet.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/FortyGigabitEthernet", state.getPath()))
	}
	if !state.SourceTenGigabitEthernet.IsNull() && data.SourceTenGigabitEthernet.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/TenGigabitEthernet", state.getPath()))
	}
	if !state.SourceGigabitEthernet.IsNull() && data.SourceGigabitEthernet.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/GigabitEthernet", state.getPath()))
	}
	if !state.UpdateCalendar.IsNull() && data.UpdateCalendar.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:update-calendar", state.getPath()))
	}
	if !state.Passive.IsNull() && data.Passive.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:passive", state.getPath()))
	}
	if !state.MasterStratum.IsNull() && data.MasterStratum.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:master/stratum-number", state.getPath()))
	}
	if !state.Master.IsNull() && data.Master.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:master", state.getPath()))
	}
	if !state.ClockPeriod.IsNull() && data.ClockPeriod.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:clock-period", state.getPath()))
	}
	for i := range state.AuthenticationKeys {
		stateKeyValues := [...]string{strconv.FormatInt(state.AuthenticationKeys[i].Number.ValueInt64(), 10)}

		emptyKeys := true
		if !reflect.ValueOf(state.AuthenticationKeys[i].Number.ValueInt64()).IsZero() {
			emptyKeys = false
		}
		if emptyKeys {
			continue
		}

		found := false
		for j := range data.AuthenticationKeys {
			found = true
			if state.AuthenticationKeys[i].Number.ValueInt64() != data.AuthenticationKeys[j].Number.ValueInt64() {
				found = false
			}
			if found {
				if !state.AuthenticationKeys[i].EncryptionType.IsNull() && data.AuthenticationKeys[j].EncryptionType.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/encryption-type", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.AuthenticationKeys[i].Sha2.IsNull() && data.AuthenticationKeys[j].Sha2.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/sha2", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.AuthenticationKeys[i].Sha1.IsNull() && data.AuthenticationKeys[j].Sha1.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/sha1", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.AuthenticationKeys[i].HmacSha2256.IsNull() && data.AuthenticationKeys[j].HmacSha2256.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/hmac-sha2-256", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.AuthenticationKeys[i].HmacSha1.IsNull() && data.AuthenticationKeys[j].HmacSha1.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/hmac-sha1", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.AuthenticationKeys[i].CmacAes128.IsNull() && data.AuthenticationKeys[j].CmacAes128.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/cmac-aes-128", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.AuthenticationKeys[i].Md5.IsNull() && data.AuthenticationKeys[j].Md5.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v/md5-cfg", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	if !state.AccessGroupServeOnlyAcl.IsNull() && data.AccessGroupServeOnlyAcl.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/serve-only/acl", state.getPath()))
	}
	if !state.AccessGroupServeAcl.IsNull() && data.AccessGroupServeAcl.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/serve/acl", state.getPath()))
	}
	if !state.AccessGroupQueryOnlyAcl.IsNull() && data.AccessGroupQueryOnlyAcl.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/query-only/acl", state.getPath()))
	}
	if !state.AccessGroupPeerAcl.IsNull() && data.AccessGroupPeerAcl.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/peer/acl", state.getPath()))
	}
	if !state.Logging.IsNull() && data.Logging.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:logging", state.getPath()))
	}
	if !state.Authenticate.IsNull() && data.Authenticate.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authenticate", state.getPath()))
	}

	return deletedItems
}

// End of section. //template:end getDeletedItems

// Section below is generated&owned by "gen/generator.go". //template:begin getEmptyLeafsDelete

func (data *NTP) getEmptyLeafsDelete(ctx context.Context) []string {
	emptyLeafsDelete := make([]string, 0)

	for i := range data.PeerVrfs {
		keyValues := [...]string{data.PeerVrfs[i].Name.ValueString()}

		for ci := range data.PeerVrfs[i].Peers {
			ckeyValues := [...]string{data.PeerVrfs[i].Peers[ci].IpAddress.ValueString()}
			if !data.PeerVrfs[i].Peers[ci].Prefer.IsNull() && !data.PeerVrfs[i].Peers[ci].Prefer.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v/server-list=%v/prefer", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
		}
	}

	for i := range data.Peers {
		keyValues := [...]string{data.Peers[i].IpAddress.ValueString()}
		if !data.Peers[i].Prefer.IsNull() && !data.Peers[i].Prefer.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v/prefer", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}

	for i := range data.ServerVrfs {
		keyValues := [...]string{data.ServerVrfs[i].Name.ValueString()}

		for ci := range data.ServerVrfs[i].Servers {
			ckeyValues := [...]string{data.ServerVrfs[i].Servers[ci].IpAddress.ValueString()}
			if !data.ServerVrfs[i].Servers[ci].Periodic.IsNull() && !data.ServerVrfs[i].Servers[ci].Periodic.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/periodic", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
			if !data.ServerVrfs[i].Servers[ci].Iburst.IsNull() && !data.ServerVrfs[i].Servers[ci].Iburst.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/iburst-opt", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
			if !data.ServerVrfs[i].Servers[ci].Burst.IsNull() && !data.ServerVrfs[i].Servers[ci].Burst.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/burst-opt", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
			if !data.ServerVrfs[i].Servers[ci].Prefer.IsNull() && !data.ServerVrfs[i].Servers[ci].Prefer.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v/server-list=%v/prefer", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
		}
	}

	for i := range data.Servers {
		keyValues := [...]string{data.Servers[i].IpAddress.ValueString()}
		if !data.Servers[i].Periodic.IsNull() && !data.Servers[i].Periodic.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/periodic", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Servers[i].Iburst.IsNull() && !data.Servers[i].Iburst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/iburst-opt", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Servers[i].Burst.IsNull() && !data.Servers[i].Burst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/burst-opt", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Servers[i].Prefer.IsNull() && !data.Servers[i].Prefer.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v/prefer", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}
	if !data.UpdateCalendar.IsNull() && !data.UpdateCalendar.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:update-calendar", data.getPath()))
	}
	if !data.Passive.IsNull() && !data.Passive.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:passive", data.getPath()))
	}
	if !data.Master.IsNull() && !data.Master.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:master", data.getPath()))
	}

	if !data.Logging.IsNull() && !data.Logging.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:logging", data.getPath()))
	}
	if !data.Authenticate.IsNull() && !data.Authenticate.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authenticate", data.getPath()))
	}

	return emptyLeafsDelete
}

// End of section. //template:end getEmptyLeafsDelete

// Section below is generated&owned by "gen/generator.go". //template:begin getDeletePaths

func (data *NTP) getDeletePaths(ctx context.Context) []string {
	var deletePaths []string
	for i := range data.TrustedKeys {
		keyValues := [...]string{strconv.FormatInt(data.TrustedKeys[i].Number.ValueInt64(), 10)}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:trusted-key=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.PeerVrfs {
		keyValues := [...]string{data.PeerVrfs[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/vrf=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.Peers {
		keyValues := [...]string{data.Peers[i].IpAddress.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:peer/server-list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.ServerVrfs {
		keyValues := [...]string{data.ServerVrfs[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/vrf=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.Servers {
		keyValues := [...]string{data.Servers[i].IpAddress.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:server/server-list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	if !data.SourceVlan.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Vlan", data.getPath()))
	}
	if !data.SourcePortChannelSubinterface.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Port-channel-subinterface/Port-channel", data.getPath()))
	}
	if !data.SourcePortChannel.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Port-channel", data.getPath()))
	}
	if !data.SourceLoopback.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/Loopback", data.getPath()))
	}
	if !data.SourceHundredGigabitEthernet.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/HundredGigE", data.getPath()))
	}
	if !data.SourceFortyGigabitEthernet.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/FortyGigabitEthernet", data.getPath()))
	}
	if !data.SourceTenGigabitEthernet.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/TenGigabitEthernet", data.getPath()))
	}
	if !data.SourceGigabitEthernet.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:source/GigabitEthernet", data.getPath()))
	}
	if !data.UpdateCalendar.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:update-calendar", data.getPath()))
	}
	if !data.Passive.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:passive", data.getPath()))
	}
	if !data.MasterStratum.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:master/stratum-number", data.getPath()))
	}
	if !data.Master.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:master", data.getPath()))
	}
	if !data.ClockPeriod.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:clock-period", data.getPath()))
	}
	for i := range data.AuthenticationKeys {
		keyValues := [...]string{strconv.FormatInt(data.AuthenticationKeys[i].Number.ValueInt64(), 10)}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authentication-key=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	if !data.AccessGroupServeOnlyAcl.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/serve-only/acl", data.getPath()))
	}
	if !data.AccessGroupServeAcl.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/serve/acl", data.getPath()))
	}
	if !data.AccessGroupQueryOnlyAcl.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/query-only/acl", data.getPath()))
	}
	if !data.AccessGroupPeerAcl.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:access-group/peer/acl", data.getPath()))
	}
	if !data.Logging.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:logging", data.getPath()))
	}
	if !data.Authenticate.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ntp:authenticate", data.getPath()))
	}

	return deletePaths
}

// End of section. //template:end getDeletePaths
