// 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 DeviceSensor struct {
	Device                 types.String                         `tfsdk:"device"`
	Id                     types.String                         `tfsdk:"id"`
	DeleteMode             types.String                         `tfsdk:"delete_mode"`
	FilterListsLldp        []DeviceSensorFilterListsLldp        `tfsdk:"filter_lists_lldp"`
	FilterListsDhcp        []DeviceSensorFilterListsDhcp        `tfsdk:"filter_lists_dhcp"`
	FilterListsCdp         []DeviceSensorFilterListsCdp         `tfsdk:"filter_lists_cdp"`
	FilterSpecDhcpIncludes []DeviceSensorFilterSpecDhcpIncludes `tfsdk:"filter_spec_dhcp_includes"`
	FilterSpecDhcpExcludes []DeviceSensorFilterSpecDhcpExcludes `tfsdk:"filter_spec_dhcp_excludes"`
	FilterSpecLldpIncludes []DeviceSensorFilterSpecLldpIncludes `tfsdk:"filter_spec_lldp_includes"`
	FilterSpecLldpExcludes []DeviceSensorFilterSpecLldpExcludes `tfsdk:"filter_spec_lldp_excludes"`
	FilterSpecCdpIncludes  []DeviceSensorFilterSpecCdpIncludes  `tfsdk:"filter_spec_cdp_includes"`
	FilterSpecCdpExcludes  []DeviceSensorFilterSpecCdpExcludes  `tfsdk:"filter_spec_cdp_excludes"`
	NotifyAllChanges       types.Bool                           `tfsdk:"notify_all_changes"`
}

type DeviceSensorData struct {
	Device                 types.String                         `tfsdk:"device"`
	Id                     types.String                         `tfsdk:"id"`
	FilterListsLldp        []DeviceSensorFilterListsLldp        `tfsdk:"filter_lists_lldp"`
	FilterListsDhcp        []DeviceSensorFilterListsDhcp        `tfsdk:"filter_lists_dhcp"`
	FilterListsCdp         []DeviceSensorFilterListsCdp         `tfsdk:"filter_lists_cdp"`
	FilterSpecDhcpIncludes []DeviceSensorFilterSpecDhcpIncludes `tfsdk:"filter_spec_dhcp_includes"`
	FilterSpecDhcpExcludes []DeviceSensorFilterSpecDhcpExcludes `tfsdk:"filter_spec_dhcp_excludes"`
	FilterSpecLldpIncludes []DeviceSensorFilterSpecLldpIncludes `tfsdk:"filter_spec_lldp_includes"`
	FilterSpecLldpExcludes []DeviceSensorFilterSpecLldpExcludes `tfsdk:"filter_spec_lldp_excludes"`
	FilterSpecCdpIncludes  []DeviceSensorFilterSpecCdpIncludes  `tfsdk:"filter_spec_cdp_includes"`
	FilterSpecCdpExcludes  []DeviceSensorFilterSpecCdpExcludes  `tfsdk:"filter_spec_cdp_excludes"`
	NotifyAllChanges       types.Bool                           `tfsdk:"notify_all_changes"`
}
type DeviceSensorFilterListsLldp struct {
	Name                      types.String `tfsdk:"name"`
	TlvNamePortId             types.Bool   `tfsdk:"tlv_name_port_id"`
	TlvNamePortDescription    types.Bool   `tfsdk:"tlv_name_port_description"`
	TlvNameSystemName         types.Bool   `tfsdk:"tlv_name_system_name"`
	TlvNameSystemDescription  types.Bool   `tfsdk:"tlv_name_system_description"`
	TlvNameSystemCapabilities types.Bool   `tfsdk:"tlv_name_system_capabilities"`
}
type DeviceSensorFilterListsDhcp struct {
	Name                           types.String `tfsdk:"name"`
	OptionNameHostName             types.Bool   `tfsdk:"option_name_host_name"`
	OptionNameDefaultIpTtl         types.Bool   `tfsdk:"option_name_default_ip_ttl"`
	OptionNameRequestedAddress     types.Bool   `tfsdk:"option_name_requested_address"`
	OptionNameParameterRequestList types.Bool   `tfsdk:"option_name_parameter_request_list"`
	OptionNameClassIdentifier      types.Bool   `tfsdk:"option_name_class_identifier"`
	OptionNameClientIdentifier     types.Bool   `tfsdk:"option_name_client_identifier"`
	OptionNameClientFqdn           types.Bool   `tfsdk:"option_name_client_fqdn"`
}
type DeviceSensorFilterListsCdp struct {
	Name                    types.String `tfsdk:"name"`
	TlvNameDeviceName       types.Bool   `tfsdk:"tlv_name_device_name"`
	TlvNameAddressType      types.Bool   `tfsdk:"tlv_name_address_type"`
	TlvNamePortIdType       types.Bool   `tfsdk:"tlv_name_port_id_type"`
	TlvNameCapabilitiesType types.Bool   `tfsdk:"tlv_name_capabilities_type"`
	TlvNamePlatformType     types.Bool   `tfsdk:"tlv_name_platform_type"`
}
type DeviceSensorFilterSpecDhcpIncludes struct {
	Name types.String `tfsdk:"name"`
}
type DeviceSensorFilterSpecDhcpExcludes struct {
	Name types.String `tfsdk:"name"`
}
type DeviceSensorFilterSpecLldpIncludes struct {
	Name types.String `tfsdk:"name"`
}
type DeviceSensorFilterSpecLldpExcludes struct {
	Name types.String `tfsdk:"name"`
}
type DeviceSensorFilterSpecCdpIncludes struct {
	Name types.String `tfsdk:"name"`
}
type DeviceSensorFilterSpecCdpExcludes struct {
	Name types.String `tfsdk:"name"`
}

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

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

func (data DeviceSensor) getPath() string {
	return "Cisco-IOS-XE-native:native/Cisco-IOS-XE-device-sensor:device-sensor"
}

func (data DeviceSensorData) getPath() string {
	return "Cisco-IOS-XE-native:native/Cisco-IOS-XE-device-sensor:device-sensor"
}

// if last path element has a key -> remove it
func (data DeviceSensor) 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 DeviceSensor) toBody(ctx context.Context) string {
	body := `{"` + helpers.LastElement(data.getPath()) + `":{}}`
	if !data.NotifyAllChanges.IsNull() && !data.NotifyAllChanges.IsUnknown() {
		if data.NotifyAllChanges.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"notify.all-changes", map[string]string{})
		}
	}
	if len(data.FilterListsLldp) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list", []interface{}{})
		for index, item := range data.FilterListsLldp {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
			if !item.TlvNamePortId.IsNull() && !item.TlvNamePortId.IsUnknown() {
				if item.TlvNamePortId.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.port-id", map[string]string{})
				}
			}
			if !item.TlvNamePortDescription.IsNull() && !item.TlvNamePortDescription.IsUnknown() {
				if item.TlvNamePortDescription.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.port-description", map[string]string{})
				}
			}
			if !item.TlvNameSystemName.IsNull() && !item.TlvNameSystemName.IsUnknown() {
				if item.TlvNameSystemName.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.system-name", map[string]string{})
				}
			}
			if !item.TlvNameSystemDescription.IsNull() && !item.TlvNameSystemDescription.IsUnknown() {
				if item.TlvNameSystemDescription.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.system-description", map[string]string{})
				}
			}
			if !item.TlvNameSystemCapabilities.IsNull() && !item.TlvNameSystemCapabilities.IsUnknown() {
				if item.TlvNameSystemCapabilities.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.lldp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.system-capabilities", map[string]string{})
				}
			}
		}
	}
	if len(data.FilterListsDhcp) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list", []interface{}{})
		for index, item := range data.FilterListsDhcp {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
			if !item.OptionNameHostName.IsNull() && !item.OptionNameHostName.IsUnknown() {
				if item.OptionNameHostName.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.host-name", map[string]string{})
				}
			}
			if !item.OptionNameDefaultIpTtl.IsNull() && !item.OptionNameDefaultIpTtl.IsUnknown() {
				if item.OptionNameDefaultIpTtl.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.default-ip-ttl", map[string]string{})
				}
			}
			if !item.OptionNameRequestedAddress.IsNull() && !item.OptionNameRequestedAddress.IsUnknown() {
				if item.OptionNameRequestedAddress.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.requested-address", map[string]string{})
				}
			}
			if !item.OptionNameParameterRequestList.IsNull() && !item.OptionNameParameterRequestList.IsUnknown() {
				if item.OptionNameParameterRequestList.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.parameter-request-list", map[string]string{})
				}
			}
			if !item.OptionNameClassIdentifier.IsNull() && !item.OptionNameClassIdentifier.IsUnknown() {
				if item.OptionNameClassIdentifier.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.class-identifier", map[string]string{})
				}
			}
			if !item.OptionNameClientIdentifier.IsNull() && !item.OptionNameClientIdentifier.IsUnknown() {
				if item.OptionNameClientIdentifier.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.client-identifier", map[string]string{})
				}
			}
			if !item.OptionNameClientFqdn.IsNull() && !item.OptionNameClientFqdn.IsUnknown() {
				if item.OptionNameClientFqdn.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.dhcp.list"+"."+strconv.Itoa(index)+"."+"option.name.client-fqdn", map[string]string{})
				}
			}
		}
	}
	if len(data.FilterListsCdp) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list", []interface{}{})
		for index, item := range data.FilterListsCdp {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
			if !item.TlvNameDeviceName.IsNull() && !item.TlvNameDeviceName.IsUnknown() {
				if item.TlvNameDeviceName.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.device-name", map[string]string{})
				}
			}
			if !item.TlvNameAddressType.IsNull() && !item.TlvNameAddressType.IsUnknown() {
				if item.TlvNameAddressType.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.address-type", map[string]string{})
				}
			}
			if !item.TlvNamePortIdType.IsNull() && !item.TlvNamePortIdType.IsUnknown() {
				if item.TlvNamePortIdType.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.port-id-type", map[string]string{})
				}
			}
			if !item.TlvNameCapabilitiesType.IsNull() && !item.TlvNameCapabilitiesType.IsUnknown() {
				if item.TlvNameCapabilitiesType.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.capabilities-type", map[string]string{})
				}
			}
			if !item.TlvNamePlatformType.IsNull() && !item.TlvNamePlatformType.IsUnknown() {
				if item.TlvNamePlatformType.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-list.cdp.list"+"."+strconv.Itoa(index)+"."+"tlv.name.platform-type", map[string]string{})
				}
			}
		}
	}
	if len(data.FilterSpecDhcpIncludes) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.dhcp.include.list", []interface{}{})
		for index, item := range data.FilterSpecDhcpIncludes {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.dhcp.include.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
		}
	}
	if len(data.FilterSpecDhcpExcludes) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.dhcp.exclude.list", []interface{}{})
		for index, item := range data.FilterSpecDhcpExcludes {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.dhcp.exclude.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
		}
	}
	if len(data.FilterSpecLldpIncludes) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.lldp.include.list", []interface{}{})
		for index, item := range data.FilterSpecLldpIncludes {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.lldp.include.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
		}
	}
	if len(data.FilterSpecLldpExcludes) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.lldp.exclude.list", []interface{}{})
		for index, item := range data.FilterSpecLldpExcludes {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.lldp.exclude.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
		}
	}
	if len(data.FilterSpecCdpIncludes) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.cdp.include.list", []interface{}{})
		for index, item := range data.FilterSpecCdpIncludes {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.cdp.include.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
		}
	}
	if len(data.FilterSpecCdpExcludes) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.cdp.exclude.list", []interface{}{})
		for index, item := range data.FilterSpecCdpExcludes {
			if !item.Name.IsNull() && !item.Name.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"filter-spec.cdp.exclude.list"+"."+strconv.Itoa(index)+"."+"name", item.Name.ValueString())
			}
		}
	}
	return body
}

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

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

func (data *DeviceSensor) updateFromBody(ctx context.Context, res gjson.Result) {
	prefix := helpers.LastElement(data.getPath()) + "."
	if res.Get(helpers.LastElement(data.getPath())).IsArray() {
		prefix += "0."
	}
	for i := range data.FilterListsLldp {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterListsLldp[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-list.lldp.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("name"); value.Exists() && !data.FilterListsLldp[i].Name.IsNull() {
			data.FilterListsLldp[i].Name = types.StringValue(value.String())
		} else {
			data.FilterListsLldp[i].Name = types.StringNull()
		}
		if value := r.Get("tlv.name.port-id"); !data.FilterListsLldp[i].TlvNamePortId.IsNull() {
			if value.Exists() {
				data.FilterListsLldp[i].TlvNamePortId = types.BoolValue(true)
			} else {
				data.FilterListsLldp[i].TlvNamePortId = types.BoolValue(false)
			}
		} else {
			data.FilterListsLldp[i].TlvNamePortId = types.BoolNull()
		}
		if value := r.Get("tlv.name.port-description"); !data.FilterListsLldp[i].TlvNamePortDescription.IsNull() {
			if value.Exists() {
				data.FilterListsLldp[i].TlvNamePortDescription = types.BoolValue(true)
			} else {
				data.FilterListsLldp[i].TlvNamePortDescription = types.BoolValue(false)
			}
		} else {
			data.FilterListsLldp[i].TlvNamePortDescription = types.BoolNull()
		}
		if value := r.Get("tlv.name.system-name"); !data.FilterListsLldp[i].TlvNameSystemName.IsNull() {
			if value.Exists() {
				data.FilterListsLldp[i].TlvNameSystemName = types.BoolValue(true)
			} else {
				data.FilterListsLldp[i].TlvNameSystemName = types.BoolValue(false)
			}
		} else {
			data.FilterListsLldp[i].TlvNameSystemName = types.BoolNull()
		}
		if value := r.Get("tlv.name.system-description"); !data.FilterListsLldp[i].TlvNameSystemDescription.IsNull() {
			if value.Exists() {
				data.FilterListsLldp[i].TlvNameSystemDescription = types.BoolValue(true)
			} else {
				data.FilterListsLldp[i].TlvNameSystemDescription = types.BoolValue(false)
			}
		} else {
			data.FilterListsLldp[i].TlvNameSystemDescription = types.BoolNull()
		}
		if value := r.Get("tlv.name.system-capabilities"); !data.FilterListsLldp[i].TlvNameSystemCapabilities.IsNull() {
			if value.Exists() {
				data.FilterListsLldp[i].TlvNameSystemCapabilities = types.BoolValue(true)
			} else {
				data.FilterListsLldp[i].TlvNameSystemCapabilities = types.BoolValue(false)
			}
		} else {
			data.FilterListsLldp[i].TlvNameSystemCapabilities = types.BoolNull()
		}
	}
	for i := range data.FilterListsDhcp {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterListsDhcp[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-list.dhcp.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("name"); value.Exists() && !data.FilterListsDhcp[i].Name.IsNull() {
			data.FilterListsDhcp[i].Name = types.StringValue(value.String())
		} else {
			data.FilterListsDhcp[i].Name = types.StringNull()
		}
		if value := r.Get("option.name.host-name"); !data.FilterListsDhcp[i].OptionNameHostName.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameHostName = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameHostName = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameHostName = types.BoolNull()
		}
		if value := r.Get("option.name.default-ip-ttl"); !data.FilterListsDhcp[i].OptionNameDefaultIpTtl.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameDefaultIpTtl = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameDefaultIpTtl = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameDefaultIpTtl = types.BoolNull()
		}
		if value := r.Get("option.name.requested-address"); !data.FilterListsDhcp[i].OptionNameRequestedAddress.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameRequestedAddress = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameRequestedAddress = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameRequestedAddress = types.BoolNull()
		}
		if value := r.Get("option.name.parameter-request-list"); !data.FilterListsDhcp[i].OptionNameParameterRequestList.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameParameterRequestList = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameParameterRequestList = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameParameterRequestList = types.BoolNull()
		}
		if value := r.Get("option.name.class-identifier"); !data.FilterListsDhcp[i].OptionNameClassIdentifier.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameClassIdentifier = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameClassIdentifier = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameClassIdentifier = types.BoolNull()
		}
		if value := r.Get("option.name.client-identifier"); !data.FilterListsDhcp[i].OptionNameClientIdentifier.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameClientIdentifier = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameClientIdentifier = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameClientIdentifier = types.BoolNull()
		}
		if value := r.Get("option.name.client-fqdn"); !data.FilterListsDhcp[i].OptionNameClientFqdn.IsNull() {
			if value.Exists() {
				data.FilterListsDhcp[i].OptionNameClientFqdn = types.BoolValue(true)
			} else {
				data.FilterListsDhcp[i].OptionNameClientFqdn = types.BoolValue(false)
			}
		} else {
			data.FilterListsDhcp[i].OptionNameClientFqdn = types.BoolNull()
		}
	}
	for i := range data.FilterListsCdp {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterListsCdp[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-list.cdp.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("name"); value.Exists() && !data.FilterListsCdp[i].Name.IsNull() {
			data.FilterListsCdp[i].Name = types.StringValue(value.String())
		} else {
			data.FilterListsCdp[i].Name = types.StringNull()
		}
		if value := r.Get("tlv.name.device-name"); !data.FilterListsCdp[i].TlvNameDeviceName.IsNull() {
			if value.Exists() {
				data.FilterListsCdp[i].TlvNameDeviceName = types.BoolValue(true)
			} else {
				data.FilterListsCdp[i].TlvNameDeviceName = types.BoolValue(false)
			}
		} else {
			data.FilterListsCdp[i].TlvNameDeviceName = types.BoolNull()
		}
		if value := r.Get("tlv.name.address-type"); !data.FilterListsCdp[i].TlvNameAddressType.IsNull() {
			if value.Exists() {
				data.FilterListsCdp[i].TlvNameAddressType = types.BoolValue(true)
			} else {
				data.FilterListsCdp[i].TlvNameAddressType = types.BoolValue(false)
			}
		} else {
			data.FilterListsCdp[i].TlvNameAddressType = types.BoolNull()
		}
		if value := r.Get("tlv.name.port-id-type"); !data.FilterListsCdp[i].TlvNamePortIdType.IsNull() {
			if value.Exists() {
				data.FilterListsCdp[i].TlvNamePortIdType = types.BoolValue(true)
			} else {
				data.FilterListsCdp[i].TlvNamePortIdType = types.BoolValue(false)
			}
		} else {
			data.FilterListsCdp[i].TlvNamePortIdType = types.BoolNull()
		}
		if value := r.Get("tlv.name.capabilities-type"); !data.FilterListsCdp[i].TlvNameCapabilitiesType.IsNull() {
			if value.Exists() {
				data.FilterListsCdp[i].TlvNameCapabilitiesType = types.BoolValue(true)
			} else {
				data.FilterListsCdp[i].TlvNameCapabilitiesType = types.BoolValue(false)
			}
		} else {
			data.FilterListsCdp[i].TlvNameCapabilitiesType = types.BoolNull()
		}
		if value := r.Get("tlv.name.platform-type"); !data.FilterListsCdp[i].TlvNamePlatformType.IsNull() {
			if value.Exists() {
				data.FilterListsCdp[i].TlvNamePlatformType = types.BoolValue(true)
			} else {
				data.FilterListsCdp[i].TlvNamePlatformType = types.BoolValue(false)
			}
		} else {
			data.FilterListsCdp[i].TlvNamePlatformType = types.BoolNull()
		}
	}
	for i := range data.FilterSpecDhcpIncludes {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterSpecDhcpIncludes[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-spec.dhcp.include.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("name"); value.Exists() && !data.FilterSpecDhcpIncludes[i].Name.IsNull() {
			data.FilterSpecDhcpIncludes[i].Name = types.StringValue(value.String())
		} else {
			data.FilterSpecDhcpIncludes[i].Name = types.StringNull()
		}
	}
	for i := range data.FilterSpecDhcpExcludes {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterSpecDhcpExcludes[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-spec.dhcp.exclude.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("name"); value.Exists() && !data.FilterSpecDhcpExcludes[i].Name.IsNull() {
			data.FilterSpecDhcpExcludes[i].Name = types.StringValue(value.String())
		} else {
			data.FilterSpecDhcpExcludes[i].Name = types.StringNull()
		}
	}
	for i := range data.FilterSpecLldpIncludes {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterSpecLldpIncludes[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-spec.lldp.include.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("name"); value.Exists() && !data.FilterSpecLldpIncludes[i].Name.IsNull() {
			data.FilterSpecLldpIncludes[i].Name = types.StringValue(value.String())
		} else {
			data.FilterSpecLldpIncludes[i].Name = types.StringNull()
		}
	}
	for i := range data.FilterSpecLldpExcludes {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterSpecLldpExcludes[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-spec.lldp.exclude.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("name"); value.Exists() && !data.FilterSpecLldpExcludes[i].Name.IsNull() {
			data.FilterSpecLldpExcludes[i].Name = types.StringValue(value.String())
		} else {
			data.FilterSpecLldpExcludes[i].Name = types.StringNull()
		}
	}
	for i := range data.FilterSpecCdpIncludes {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterSpecCdpIncludes[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-spec.cdp.include.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("name"); value.Exists() && !data.FilterSpecCdpIncludes[i].Name.IsNull() {
			data.FilterSpecCdpIncludes[i].Name = types.StringValue(value.String())
		} else {
			data.FilterSpecCdpIncludes[i].Name = types.StringNull()
		}
	}
	for i := range data.FilterSpecCdpExcludes {
		keys := [...]string{"name"}
		keyValues := [...]string{data.FilterSpecCdpExcludes[i].Name.ValueString()}

		var r gjson.Result
		res.Get(prefix + "filter-spec.cdp.exclude.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("name"); value.Exists() && !data.FilterSpecCdpExcludes[i].Name.IsNull() {
			data.FilterSpecCdpExcludes[i].Name = types.StringValue(value.String())
		} else {
			data.FilterSpecCdpExcludes[i].Name = types.StringNull()
		}
	}
	if value := res.Get(prefix + "notify.all-changes"); !data.NotifyAllChanges.IsNull() {
		if value.Exists() {
			data.NotifyAllChanges = types.BoolValue(true)
		} else {
			data.NotifyAllChanges = types.BoolValue(false)
		}
	} else {
		data.NotifyAllChanges = types.BoolNull()
	}
}

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

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

func (data *DeviceSensor) 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 + "filter-list.lldp.list"); value.Exists() {
		data.FilterListsLldp = make([]DeviceSensorFilterListsLldp, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterListsLldp{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("tlv.name.port-id"); cValue.Exists() {
				item.TlvNamePortId = types.BoolValue(true)
			} else {
				item.TlvNamePortId = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.port-description"); cValue.Exists() {
				item.TlvNamePortDescription = types.BoolValue(true)
			} else {
				item.TlvNamePortDescription = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.system-name"); cValue.Exists() {
				item.TlvNameSystemName = types.BoolValue(true)
			} else {
				item.TlvNameSystemName = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.system-description"); cValue.Exists() {
				item.TlvNameSystemDescription = types.BoolValue(true)
			} else {
				item.TlvNameSystemDescription = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.system-capabilities"); cValue.Exists() {
				item.TlvNameSystemCapabilities = types.BoolValue(true)
			} else {
				item.TlvNameSystemCapabilities = types.BoolValue(false)
			}
			data.FilterListsLldp = append(data.FilterListsLldp, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-list.dhcp.list"); value.Exists() {
		data.FilterListsDhcp = make([]DeviceSensorFilterListsDhcp, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterListsDhcp{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("option.name.host-name"); cValue.Exists() {
				item.OptionNameHostName = types.BoolValue(true)
			} else {
				item.OptionNameHostName = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.default-ip-ttl"); cValue.Exists() {
				item.OptionNameDefaultIpTtl = types.BoolValue(true)
			} else {
				item.OptionNameDefaultIpTtl = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.requested-address"); cValue.Exists() {
				item.OptionNameRequestedAddress = types.BoolValue(true)
			} else {
				item.OptionNameRequestedAddress = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.parameter-request-list"); cValue.Exists() {
				item.OptionNameParameterRequestList = types.BoolValue(true)
			} else {
				item.OptionNameParameterRequestList = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.class-identifier"); cValue.Exists() {
				item.OptionNameClassIdentifier = types.BoolValue(true)
			} else {
				item.OptionNameClassIdentifier = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.client-identifier"); cValue.Exists() {
				item.OptionNameClientIdentifier = types.BoolValue(true)
			} else {
				item.OptionNameClientIdentifier = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.client-fqdn"); cValue.Exists() {
				item.OptionNameClientFqdn = types.BoolValue(true)
			} else {
				item.OptionNameClientFqdn = types.BoolValue(false)
			}
			data.FilterListsDhcp = append(data.FilterListsDhcp, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-list.cdp.list"); value.Exists() {
		data.FilterListsCdp = make([]DeviceSensorFilterListsCdp, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterListsCdp{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("tlv.name.device-name"); cValue.Exists() {
				item.TlvNameDeviceName = types.BoolValue(true)
			} else {
				item.TlvNameDeviceName = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.address-type"); cValue.Exists() {
				item.TlvNameAddressType = types.BoolValue(true)
			} else {
				item.TlvNameAddressType = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.port-id-type"); cValue.Exists() {
				item.TlvNamePortIdType = types.BoolValue(true)
			} else {
				item.TlvNamePortIdType = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.capabilities-type"); cValue.Exists() {
				item.TlvNameCapabilitiesType = types.BoolValue(true)
			} else {
				item.TlvNameCapabilitiesType = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.platform-type"); cValue.Exists() {
				item.TlvNamePlatformType = types.BoolValue(true)
			} else {
				item.TlvNamePlatformType = types.BoolValue(false)
			}
			data.FilterListsCdp = append(data.FilterListsCdp, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.dhcp.include.list"); value.Exists() {
		data.FilterSpecDhcpIncludes = make([]DeviceSensorFilterSpecDhcpIncludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecDhcpIncludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecDhcpIncludes = append(data.FilterSpecDhcpIncludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.dhcp.exclude.list"); value.Exists() {
		data.FilterSpecDhcpExcludes = make([]DeviceSensorFilterSpecDhcpExcludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecDhcpExcludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecDhcpExcludes = append(data.FilterSpecDhcpExcludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.lldp.include.list"); value.Exists() {
		data.FilterSpecLldpIncludes = make([]DeviceSensorFilterSpecLldpIncludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecLldpIncludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecLldpIncludes = append(data.FilterSpecLldpIncludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.lldp.exclude.list"); value.Exists() {
		data.FilterSpecLldpExcludes = make([]DeviceSensorFilterSpecLldpExcludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecLldpExcludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecLldpExcludes = append(data.FilterSpecLldpExcludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.cdp.include.list"); value.Exists() {
		data.FilterSpecCdpIncludes = make([]DeviceSensorFilterSpecCdpIncludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecCdpIncludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecCdpIncludes = append(data.FilterSpecCdpIncludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.cdp.exclude.list"); value.Exists() {
		data.FilterSpecCdpExcludes = make([]DeviceSensorFilterSpecCdpExcludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecCdpExcludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecCdpExcludes = append(data.FilterSpecCdpExcludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "notify.all-changes"); value.Exists() {
		data.NotifyAllChanges = types.BoolValue(true)
	} else {
		data.NotifyAllChanges = types.BoolValue(false)
	}
}

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

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

func (data *DeviceSensorData) 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 + "filter-list.lldp.list"); value.Exists() {
		data.FilterListsLldp = make([]DeviceSensorFilterListsLldp, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterListsLldp{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("tlv.name.port-id"); cValue.Exists() {
				item.TlvNamePortId = types.BoolValue(true)
			} else {
				item.TlvNamePortId = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.port-description"); cValue.Exists() {
				item.TlvNamePortDescription = types.BoolValue(true)
			} else {
				item.TlvNamePortDescription = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.system-name"); cValue.Exists() {
				item.TlvNameSystemName = types.BoolValue(true)
			} else {
				item.TlvNameSystemName = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.system-description"); cValue.Exists() {
				item.TlvNameSystemDescription = types.BoolValue(true)
			} else {
				item.TlvNameSystemDescription = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.system-capabilities"); cValue.Exists() {
				item.TlvNameSystemCapabilities = types.BoolValue(true)
			} else {
				item.TlvNameSystemCapabilities = types.BoolValue(false)
			}
			data.FilterListsLldp = append(data.FilterListsLldp, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-list.dhcp.list"); value.Exists() {
		data.FilterListsDhcp = make([]DeviceSensorFilterListsDhcp, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterListsDhcp{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("option.name.host-name"); cValue.Exists() {
				item.OptionNameHostName = types.BoolValue(true)
			} else {
				item.OptionNameHostName = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.default-ip-ttl"); cValue.Exists() {
				item.OptionNameDefaultIpTtl = types.BoolValue(true)
			} else {
				item.OptionNameDefaultIpTtl = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.requested-address"); cValue.Exists() {
				item.OptionNameRequestedAddress = types.BoolValue(true)
			} else {
				item.OptionNameRequestedAddress = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.parameter-request-list"); cValue.Exists() {
				item.OptionNameParameterRequestList = types.BoolValue(true)
			} else {
				item.OptionNameParameterRequestList = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.class-identifier"); cValue.Exists() {
				item.OptionNameClassIdentifier = types.BoolValue(true)
			} else {
				item.OptionNameClassIdentifier = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.client-identifier"); cValue.Exists() {
				item.OptionNameClientIdentifier = types.BoolValue(true)
			} else {
				item.OptionNameClientIdentifier = types.BoolValue(false)
			}
			if cValue := v.Get("option.name.client-fqdn"); cValue.Exists() {
				item.OptionNameClientFqdn = types.BoolValue(true)
			} else {
				item.OptionNameClientFqdn = types.BoolValue(false)
			}
			data.FilterListsDhcp = append(data.FilterListsDhcp, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-list.cdp.list"); value.Exists() {
		data.FilterListsCdp = make([]DeviceSensorFilterListsCdp, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterListsCdp{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			if cValue := v.Get("tlv.name.device-name"); cValue.Exists() {
				item.TlvNameDeviceName = types.BoolValue(true)
			} else {
				item.TlvNameDeviceName = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.address-type"); cValue.Exists() {
				item.TlvNameAddressType = types.BoolValue(true)
			} else {
				item.TlvNameAddressType = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.port-id-type"); cValue.Exists() {
				item.TlvNamePortIdType = types.BoolValue(true)
			} else {
				item.TlvNamePortIdType = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.capabilities-type"); cValue.Exists() {
				item.TlvNameCapabilitiesType = types.BoolValue(true)
			} else {
				item.TlvNameCapabilitiesType = types.BoolValue(false)
			}
			if cValue := v.Get("tlv.name.platform-type"); cValue.Exists() {
				item.TlvNamePlatformType = types.BoolValue(true)
			} else {
				item.TlvNamePlatformType = types.BoolValue(false)
			}
			data.FilterListsCdp = append(data.FilterListsCdp, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.dhcp.include.list"); value.Exists() {
		data.FilterSpecDhcpIncludes = make([]DeviceSensorFilterSpecDhcpIncludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecDhcpIncludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecDhcpIncludes = append(data.FilterSpecDhcpIncludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.dhcp.exclude.list"); value.Exists() {
		data.FilterSpecDhcpExcludes = make([]DeviceSensorFilterSpecDhcpExcludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecDhcpExcludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecDhcpExcludes = append(data.FilterSpecDhcpExcludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.lldp.include.list"); value.Exists() {
		data.FilterSpecLldpIncludes = make([]DeviceSensorFilterSpecLldpIncludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecLldpIncludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecLldpIncludes = append(data.FilterSpecLldpIncludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.lldp.exclude.list"); value.Exists() {
		data.FilterSpecLldpExcludes = make([]DeviceSensorFilterSpecLldpExcludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecLldpExcludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecLldpExcludes = append(data.FilterSpecLldpExcludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.cdp.include.list"); value.Exists() {
		data.FilterSpecCdpIncludes = make([]DeviceSensorFilterSpecCdpIncludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecCdpIncludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecCdpIncludes = append(data.FilterSpecCdpIncludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "filter-spec.cdp.exclude.list"); value.Exists() {
		data.FilterSpecCdpExcludes = make([]DeviceSensorFilterSpecCdpExcludes, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := DeviceSensorFilterSpecCdpExcludes{}
			if cValue := v.Get("name"); cValue.Exists() {
				item.Name = types.StringValue(cValue.String())
			}
			data.FilterSpecCdpExcludes = append(data.FilterSpecCdpExcludes, item)
			return true
		})
	}
	if value := res.Get(prefix + "notify.all-changes"); value.Exists() {
		data.NotifyAllChanges = types.BoolValue(true)
	} else {
		data.NotifyAllChanges = types.BoolValue(false)
	}
}

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

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

func (data *DeviceSensor) getDeletedItems(ctx context.Context, state DeviceSensor) []string {
	deletedItems := make([]string, 0)
	if !state.NotifyAllChanges.IsNull() && data.NotifyAllChanges.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/notify/all-changes", state.getPath()))
	}
	for i := range state.FilterSpecCdpExcludes {
		stateKeyValues := [...]string{state.FilterSpecCdpExcludes[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterSpecCdpExcludes {
			found = true
			if state.FilterSpecCdpExcludes[i].Name.ValueString() != data.FilterSpecCdpExcludes[j].Name.ValueString() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-spec/cdp/exclude/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterSpecCdpIncludes {
		stateKeyValues := [...]string{state.FilterSpecCdpIncludes[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterSpecCdpIncludes {
			found = true
			if state.FilterSpecCdpIncludes[i].Name.ValueString() != data.FilterSpecCdpIncludes[j].Name.ValueString() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-spec/cdp/include/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterSpecLldpExcludes {
		stateKeyValues := [...]string{state.FilterSpecLldpExcludes[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterSpecLldpExcludes {
			found = true
			if state.FilterSpecLldpExcludes[i].Name.ValueString() != data.FilterSpecLldpExcludes[j].Name.ValueString() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-spec/lldp/exclude/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterSpecLldpIncludes {
		stateKeyValues := [...]string{state.FilterSpecLldpIncludes[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterSpecLldpIncludes {
			found = true
			if state.FilterSpecLldpIncludes[i].Name.ValueString() != data.FilterSpecLldpIncludes[j].Name.ValueString() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-spec/lldp/include/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterSpecDhcpExcludes {
		stateKeyValues := [...]string{state.FilterSpecDhcpExcludes[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterSpecDhcpExcludes {
			found = true
			if state.FilterSpecDhcpExcludes[i].Name.ValueString() != data.FilterSpecDhcpExcludes[j].Name.ValueString() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-spec/dhcp/exclude/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterSpecDhcpIncludes {
		stateKeyValues := [...]string{state.FilterSpecDhcpIncludes[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterSpecDhcpIncludes {
			found = true
			if state.FilterSpecDhcpIncludes[i].Name.ValueString() != data.FilterSpecDhcpIncludes[j].Name.ValueString() {
				found = false
			}
			if found {
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-spec/dhcp/include/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterListsCdp {
		stateKeyValues := [...]string{state.FilterListsCdp[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterListsCdp {
			found = true
			if state.FilterListsCdp[i].Name.ValueString() != data.FilterListsCdp[j].Name.ValueString() {
				found = false
			}
			if found {
				if !state.FilterListsCdp[i].TlvNamePlatformType.IsNull() && data.FilterListsCdp[j].TlvNamePlatformType.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/platform-type", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsCdp[i].TlvNameCapabilitiesType.IsNull() && data.FilterListsCdp[j].TlvNameCapabilitiesType.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/capabilities-type", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsCdp[i].TlvNamePortIdType.IsNull() && data.FilterListsCdp[j].TlvNamePortIdType.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/port-id-type", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsCdp[i].TlvNameAddressType.IsNull() && data.FilterListsCdp[j].TlvNameAddressType.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/address-type", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsCdp[i].TlvNameDeviceName.IsNull() && data.FilterListsCdp[j].TlvNameDeviceName.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/device-name", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/cdp/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterListsDhcp {
		stateKeyValues := [...]string{state.FilterListsDhcp[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterListsDhcp {
			found = true
			if state.FilterListsDhcp[i].Name.ValueString() != data.FilterListsDhcp[j].Name.ValueString() {
				found = false
			}
			if found {
				if !state.FilterListsDhcp[i].OptionNameClientFqdn.IsNull() && data.FilterListsDhcp[j].OptionNameClientFqdn.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/client-fqdn", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsDhcp[i].OptionNameClientIdentifier.IsNull() && data.FilterListsDhcp[j].OptionNameClientIdentifier.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/client-identifier", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsDhcp[i].OptionNameClassIdentifier.IsNull() && data.FilterListsDhcp[j].OptionNameClassIdentifier.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/class-identifier", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsDhcp[i].OptionNameParameterRequestList.IsNull() && data.FilterListsDhcp[j].OptionNameParameterRequestList.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/parameter-request-list", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsDhcp[i].OptionNameRequestedAddress.IsNull() && data.FilterListsDhcp[j].OptionNameRequestedAddress.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/requested-address", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsDhcp[i].OptionNameDefaultIpTtl.IsNull() && data.FilterListsDhcp[j].OptionNameDefaultIpTtl.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/default-ip-ttl", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsDhcp[i].OptionNameHostName.IsNull() && data.FilterListsDhcp[j].OptionNameHostName.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/host-name", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/dhcp/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.FilterListsLldp {
		stateKeyValues := [...]string{state.FilterListsLldp[i].Name.ValueString()}

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

		found := false
		for j := range data.FilterListsLldp {
			found = true
			if state.FilterListsLldp[i].Name.ValueString() != data.FilterListsLldp[j].Name.ValueString() {
				found = false
			}
			if found {
				if !state.FilterListsLldp[i].TlvNameSystemCapabilities.IsNull() && data.FilterListsLldp[j].TlvNameSystemCapabilities.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/system-capabilities", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsLldp[i].TlvNameSystemDescription.IsNull() && data.FilterListsLldp[j].TlvNameSystemDescription.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/system-description", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsLldp[i].TlvNameSystemName.IsNull() && data.FilterListsLldp[j].TlvNameSystemName.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/system-name", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsLldp[i].TlvNamePortDescription.IsNull() && data.FilterListsLldp[j].TlvNamePortDescription.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/port-description", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.FilterListsLldp[i].TlvNamePortId.IsNull() && data.FilterListsLldp[j].TlvNamePortId.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/port-id", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/filter-list/lldp/list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}

	return deletedItems
}

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

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

func (data *DeviceSensor) getEmptyLeafsDelete(ctx context.Context) []string {
	emptyLeafsDelete := make([]string, 0)
	if !data.NotifyAllChanges.IsNull() && !data.NotifyAllChanges.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/notify/all-changes", data.getPath()))
	}

	for i := range data.FilterListsCdp {
		keyValues := [...]string{data.FilterListsCdp[i].Name.ValueString()}
		if !data.FilterListsCdp[i].TlvNamePlatformType.IsNull() && !data.FilterListsCdp[i].TlvNamePlatformType.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/platform-type", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsCdp[i].TlvNameCapabilitiesType.IsNull() && !data.FilterListsCdp[i].TlvNameCapabilitiesType.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/capabilities-type", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsCdp[i].TlvNamePortIdType.IsNull() && !data.FilterListsCdp[i].TlvNamePortIdType.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/port-id-type", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsCdp[i].TlvNameAddressType.IsNull() && !data.FilterListsCdp[i].TlvNameAddressType.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/address-type", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsCdp[i].TlvNameDeviceName.IsNull() && !data.FilterListsCdp[i].TlvNameDeviceName.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/cdp/list=%v/tlv/name/device-name", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}

	for i := range data.FilterListsDhcp {
		keyValues := [...]string{data.FilterListsDhcp[i].Name.ValueString()}
		if !data.FilterListsDhcp[i].OptionNameClientFqdn.IsNull() && !data.FilterListsDhcp[i].OptionNameClientFqdn.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/client-fqdn", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsDhcp[i].OptionNameClientIdentifier.IsNull() && !data.FilterListsDhcp[i].OptionNameClientIdentifier.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/client-identifier", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsDhcp[i].OptionNameClassIdentifier.IsNull() && !data.FilterListsDhcp[i].OptionNameClassIdentifier.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/class-identifier", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsDhcp[i].OptionNameParameterRequestList.IsNull() && !data.FilterListsDhcp[i].OptionNameParameterRequestList.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/parameter-request-list", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsDhcp[i].OptionNameRequestedAddress.IsNull() && !data.FilterListsDhcp[i].OptionNameRequestedAddress.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/requested-address", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsDhcp[i].OptionNameDefaultIpTtl.IsNull() && !data.FilterListsDhcp[i].OptionNameDefaultIpTtl.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/default-ip-ttl", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsDhcp[i].OptionNameHostName.IsNull() && !data.FilterListsDhcp[i].OptionNameHostName.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/dhcp/list=%v/option/name/host-name", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}

	for i := range data.FilterListsLldp {
		keyValues := [...]string{data.FilterListsLldp[i].Name.ValueString()}
		if !data.FilterListsLldp[i].TlvNameSystemCapabilities.IsNull() && !data.FilterListsLldp[i].TlvNameSystemCapabilities.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/system-capabilities", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsLldp[i].TlvNameSystemDescription.IsNull() && !data.FilterListsLldp[i].TlvNameSystemDescription.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/system-description", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsLldp[i].TlvNameSystemName.IsNull() && !data.FilterListsLldp[i].TlvNameSystemName.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/system-name", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsLldp[i].TlvNamePortDescription.IsNull() && !data.FilterListsLldp[i].TlvNamePortDescription.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/port-description", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.FilterListsLldp[i].TlvNamePortId.IsNull() && !data.FilterListsLldp[i].TlvNamePortId.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/filter-list/lldp/list=%v/tlv/name/port-id", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}

	return emptyLeafsDelete
}

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

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

func (data *DeviceSensor) getDeletePaths(ctx context.Context) []string {
	var deletePaths []string
	if !data.NotifyAllChanges.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/notify/all-changes", data.getPath()))
	}
	for i := range data.FilterSpecCdpExcludes {
		keyValues := [...]string{data.FilterSpecCdpExcludes[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-spec/cdp/exclude/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterSpecCdpIncludes {
		keyValues := [...]string{data.FilterSpecCdpIncludes[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-spec/cdp/include/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterSpecLldpExcludes {
		keyValues := [...]string{data.FilterSpecLldpExcludes[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-spec/lldp/exclude/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterSpecLldpIncludes {
		keyValues := [...]string{data.FilterSpecLldpIncludes[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-spec/lldp/include/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterSpecDhcpExcludes {
		keyValues := [...]string{data.FilterSpecDhcpExcludes[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-spec/dhcp/exclude/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterSpecDhcpIncludes {
		keyValues := [...]string{data.FilterSpecDhcpIncludes[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-spec/dhcp/include/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterListsCdp {
		keyValues := [...]string{data.FilterListsCdp[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-list/cdp/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterListsDhcp {
		keyValues := [...]string{data.FilterListsDhcp[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-list/dhcp/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.FilterListsLldp {
		keyValues := [...]string{data.FilterListsLldp[i].Name.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/filter-list/lldp/list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}

	return deletePaths
}

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