// 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 PIM struct {
	Device                        types.String      `tfsdk:"device"`
	Id                            types.String      `tfsdk:"id"`
	DeleteMode                    types.String      `tfsdk:"delete_mode"`
	Autorp                        types.Bool        `tfsdk:"autorp"`
	AutorpListener                types.Bool        `tfsdk:"autorp_listener"`
	BsrCandidateLoopback          types.Int64       `tfsdk:"bsr_candidate_loopback"`
	BsrCandidateMask              types.Int64       `tfsdk:"bsr_candidate_mask"`
	BsrCandidatePriority          types.Int64       `tfsdk:"bsr_candidate_priority"`
	BsrCandidateAcceptRpCandidate types.String      `tfsdk:"bsr_candidate_accept_rp_candidate"`
	SsmRange                      types.String      `tfsdk:"ssm_range"`
	SsmDefault                    types.Bool        `tfsdk:"ssm_default"`
	RpAddress                     types.String      `tfsdk:"rp_address"`
	RpAddressOverride             types.Bool        `tfsdk:"rp_address_override"`
	RpAddressBidir                types.Bool        `tfsdk:"rp_address_bidir"`
	RpAddresses                   []PIMRpAddresses  `tfsdk:"rp_addresses"`
	RpCandidates                  []PIMRpCandidates `tfsdk:"rp_candidates"`
	Vrfs                          []PIMVrfs         `tfsdk:"vrfs"`
}

type PIMData struct {
	Device                        types.String      `tfsdk:"device"`
	Id                            types.String      `tfsdk:"id"`
	Autorp                        types.Bool        `tfsdk:"autorp"`
	AutorpListener                types.Bool        `tfsdk:"autorp_listener"`
	BsrCandidateLoopback          types.Int64       `tfsdk:"bsr_candidate_loopback"`
	BsrCandidateMask              types.Int64       `tfsdk:"bsr_candidate_mask"`
	BsrCandidatePriority          types.Int64       `tfsdk:"bsr_candidate_priority"`
	BsrCandidateAcceptRpCandidate types.String      `tfsdk:"bsr_candidate_accept_rp_candidate"`
	SsmRange                      types.String      `tfsdk:"ssm_range"`
	SsmDefault                    types.Bool        `tfsdk:"ssm_default"`
	RpAddress                     types.String      `tfsdk:"rp_address"`
	RpAddressOverride             types.Bool        `tfsdk:"rp_address_override"`
	RpAddressBidir                types.Bool        `tfsdk:"rp_address_bidir"`
	RpAddresses                   []PIMRpAddresses  `tfsdk:"rp_addresses"`
	RpCandidates                  []PIMRpCandidates `tfsdk:"rp_candidates"`
	Vrfs                          []PIMVrfs         `tfsdk:"vrfs"`
}
type PIMRpAddresses struct {
	AccessList types.String `tfsdk:"access_list"`
	RpAddress  types.String `tfsdk:"rp_address"`
	Override   types.Bool   `tfsdk:"override"`
	Bidir      types.Bool   `tfsdk:"bidir"`
}
type PIMRpCandidates struct {
	Interface types.String `tfsdk:"interface"`
	GroupList types.String `tfsdk:"group_list"`
	Interval  types.Int64  `tfsdk:"interval"`
	Priority  types.Int64  `tfsdk:"priority"`
	Bidir     types.Bool   `tfsdk:"bidir"`
}
type PIMVrfs struct {
	Vrf                           types.String          `tfsdk:"vrf"`
	Autorp                        types.Bool            `tfsdk:"autorp"`
	AutorpListener                types.Bool            `tfsdk:"autorp_listener"`
	BsrCandidateLoopback          types.Int64           `tfsdk:"bsr_candidate_loopback"`
	BsrCandidateMask              types.Int64           `tfsdk:"bsr_candidate_mask"`
	BsrCandidatePriority          types.Int64           `tfsdk:"bsr_candidate_priority"`
	BsrCandidateAcceptRpCandidate types.String          `tfsdk:"bsr_candidate_accept_rp_candidate"`
	SsmRange                      types.String          `tfsdk:"ssm_range"`
	SsmDefault                    types.Bool            `tfsdk:"ssm_default"`
	RpAddress                     types.String          `tfsdk:"rp_address"`
	RpAddressOverride             types.Bool            `tfsdk:"rp_address_override"`
	RpAddressBidir                types.Bool            `tfsdk:"rp_address_bidir"`
	CacheRpfOif                   types.Bool            `tfsdk:"cache_rpf_oif"`
	RpAddresses                   []PIMVrfsRpAddresses  `tfsdk:"rp_addresses"`
	RpCandidates                  []PIMVrfsRpCandidates `tfsdk:"rp_candidates"`
}
type PIMVrfsRpAddresses struct {
	AccessList types.String `tfsdk:"access_list"`
	RpAddress  types.String `tfsdk:"rp_address"`
	Override   types.Bool   `tfsdk:"override"`
	Bidir      types.Bool   `tfsdk:"bidir"`
}
type PIMVrfsRpCandidates struct {
	Interface types.String `tfsdk:"interface"`
	GroupList types.String `tfsdk:"group_list"`
	Interval  types.Int64  `tfsdk:"interval"`
	Priority  types.Int64  `tfsdk:"priority"`
	Bidir     types.Bool   `tfsdk:"bidir"`
}

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

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

func (data PIM) getPath() string {
	return "Cisco-IOS-XE-native:native/ip/pim"
}

func (data PIMData) getPath() string {
	return "Cisco-IOS-XE-native:native/ip/pim"
}

// if last path element has a key -> remove it
func (data PIM) 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 PIM) toBody(ctx context.Context) string {
	body := `{"` + helpers.LastElement(data.getPath()) + `":{}}`
	if !data.Autorp.IsNull() && !data.Autorp.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:autorp-container.autorp", data.Autorp.ValueBool())
	}
	if !data.AutorpListener.IsNull() && !data.AutorpListener.IsUnknown() {
		if data.AutorpListener.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:autorp-container.listener", map[string]string{})
		}
	}
	if !data.BsrCandidateLoopback.IsNull() && !data.BsrCandidateLoopback.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:bsr-candidate.Loopback", strconv.FormatInt(data.BsrCandidateLoopback.ValueInt64(), 10))
	}
	if !data.BsrCandidateMask.IsNull() && !data.BsrCandidateMask.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:bsr-candidate.mask", strconv.FormatInt(data.BsrCandidateMask.ValueInt64(), 10))
	}
	if !data.BsrCandidatePriority.IsNull() && !data.BsrCandidatePriority.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:bsr-candidate.priority", strconv.FormatInt(data.BsrCandidatePriority.ValueInt64(), 10))
	}
	if !data.BsrCandidateAcceptRpCandidate.IsNull() && !data.BsrCandidateAcceptRpCandidate.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:bsr-candidate.accept-rp-candidate", data.BsrCandidateAcceptRpCandidate.ValueString())
	}
	if !data.SsmRange.IsNull() && !data.SsmRange.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:ssm.range", data.SsmRange.ValueString())
	}
	if !data.SsmDefault.IsNull() && !data.SsmDefault.IsUnknown() {
		if data.SsmDefault.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:ssm.default", map[string]string{})
		}
	}
	if !data.RpAddress.IsNull() && !data.RpAddress.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-conf.address", data.RpAddress.ValueString())
	}
	if !data.RpAddressOverride.IsNull() && !data.RpAddressOverride.IsUnknown() {
		if data.RpAddressOverride.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-conf.override", map[string]string{})
		}
	}
	if !data.RpAddressBidir.IsNull() && !data.RpAddressBidir.IsUnknown() {
		if data.RpAddressBidir.ValueBool() {
			body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-conf.bidir", map[string]string{})
		}
	}
	if len(data.RpAddresses) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-list", []interface{}{})
		for index, item := range data.RpAddresses {
			if !item.AccessList.IsNull() && !item.AccessList.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-list"+"."+strconv.Itoa(index)+"."+"access-list", item.AccessList.ValueString())
			}
			if !item.RpAddress.IsNull() && !item.RpAddress.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-list"+"."+strconv.Itoa(index)+"."+"rp-address", item.RpAddress.ValueString())
			}
			if !item.Override.IsNull() && !item.Override.IsUnknown() {
				if item.Override.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-list"+"."+strconv.Itoa(index)+"."+"override", map[string]string{})
				}
			}
			if !item.Bidir.IsNull() && !item.Bidir.IsUnknown() {
				if item.Bidir.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-address-list"+"."+strconv.Itoa(index)+"."+"bidir", map[string]string{})
				}
			}
		}
	}
	if len(data.RpCandidates) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-candidate", []interface{}{})
		for index, item := range data.RpCandidates {
			if !item.Interface.IsNull() && !item.Interface.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-candidate"+"."+strconv.Itoa(index)+"."+"interface", item.Interface.ValueString())
			}
			if !item.GroupList.IsNull() && !item.GroupList.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-candidate"+"."+strconv.Itoa(index)+"."+"group-list", item.GroupList.ValueString())
			}
			if !item.Interval.IsNull() && !item.Interval.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-candidate"+"."+strconv.Itoa(index)+"."+"interval", strconv.FormatInt(item.Interval.ValueInt64(), 10))
			}
			if !item.Priority.IsNull() && !item.Priority.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-candidate"+"."+strconv.Itoa(index)+"."+"priority", strconv.FormatInt(item.Priority.ValueInt64(), 10))
			}
			if !item.Bidir.IsNull() && !item.Bidir.IsUnknown() {
				if item.Bidir.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:rp-candidate"+"."+strconv.Itoa(index)+"."+"bidir", map[string]string{})
				}
			}
		}
	}
	if len(data.Vrfs) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf", []interface{}{})
		for index, item := range data.Vrfs {
			if !item.Vrf.IsNull() && !item.Vrf.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"id", item.Vrf.ValueString())
			}
			if !item.Autorp.IsNull() && !item.Autorp.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"autorp-container.autorp", item.Autorp.ValueBool())
			}
			if !item.AutorpListener.IsNull() && !item.AutorpListener.IsUnknown() {
				if item.AutorpListener.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"autorp-container.listener", map[string]string{})
				}
			}
			if !item.BsrCandidateLoopback.IsNull() && !item.BsrCandidateLoopback.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"bsr-candidate.Loopback", strconv.FormatInt(item.BsrCandidateLoopback.ValueInt64(), 10))
			}
			if !item.BsrCandidateMask.IsNull() && !item.BsrCandidateMask.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"bsr-candidate.mask", strconv.FormatInt(item.BsrCandidateMask.ValueInt64(), 10))
			}
			if !item.BsrCandidatePriority.IsNull() && !item.BsrCandidatePriority.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"bsr-candidate.priority", strconv.FormatInt(item.BsrCandidatePriority.ValueInt64(), 10))
			}
			if !item.BsrCandidateAcceptRpCandidate.IsNull() && !item.BsrCandidateAcceptRpCandidate.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"bsr-candidate.accept-rp-candidate", item.BsrCandidateAcceptRpCandidate.ValueString())
			}
			if !item.SsmRange.IsNull() && !item.SsmRange.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"ssm.range", item.SsmRange.ValueString())
			}
			if !item.SsmDefault.IsNull() && !item.SsmDefault.IsUnknown() {
				if item.SsmDefault.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"ssm.default", map[string]string{})
				}
			}
			if !item.RpAddress.IsNull() && !item.RpAddress.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-conf.address", item.RpAddress.ValueString())
			}
			if !item.RpAddressOverride.IsNull() && !item.RpAddressOverride.IsUnknown() {
				if item.RpAddressOverride.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-conf.override", map[string]string{})
				}
			}
			if !item.RpAddressBidir.IsNull() && !item.RpAddressBidir.IsUnknown() {
				if item.RpAddressBidir.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-conf.bidir", map[string]string{})
				}
			}
			if !item.CacheRpfOif.IsNull() && !item.CacheRpfOif.IsUnknown() {
				if item.CacheRpfOif.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"cache.rpf-oif", map[string]string{})
				}
			}
			if len(item.RpAddresses) > 0 {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-list", []interface{}{})
				for cindex, citem := range item.RpAddresses {
					if !citem.AccessList.IsNull() && !citem.AccessList.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-list"+"."+strconv.Itoa(cindex)+"."+"access-list", citem.AccessList.ValueString())
					}
					if !citem.RpAddress.IsNull() && !citem.RpAddress.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-list"+"."+strconv.Itoa(cindex)+"."+"rp-address", citem.RpAddress.ValueString())
					}
					if !citem.Override.IsNull() && !citem.Override.IsUnknown() {
						if citem.Override.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-list"+"."+strconv.Itoa(cindex)+"."+"override", map[string]string{})
						}
					}
					if !citem.Bidir.IsNull() && !citem.Bidir.IsUnknown() {
						if citem.Bidir.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-address-list"+"."+strconv.Itoa(cindex)+"."+"bidir", map[string]string{})
						}
					}
				}
			}
			if len(item.RpCandidates) > 0 {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-candidate", []interface{}{})
				for cindex, citem := range item.RpCandidates {
					if !citem.Interface.IsNull() && !citem.Interface.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-candidate"+"."+strconv.Itoa(cindex)+"."+"interface", citem.Interface.ValueString())
					}
					if !citem.GroupList.IsNull() && !citem.GroupList.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-candidate"+"."+strconv.Itoa(cindex)+"."+"group-list", citem.GroupList.ValueString())
					}
					if !citem.Interval.IsNull() && !citem.Interval.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-candidate"+"."+strconv.Itoa(cindex)+"."+"interval", strconv.FormatInt(citem.Interval.ValueInt64(), 10))
					}
					if !citem.Priority.IsNull() && !citem.Priority.IsUnknown() {
						body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-candidate"+"."+strconv.Itoa(cindex)+"."+"priority", strconv.FormatInt(citem.Priority.ValueInt64(), 10))
					}
					if !citem.Bidir.IsNull() && !citem.Bidir.IsUnknown() {
						if citem.Bidir.ValueBool() {
							body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-multicast:vrf"+"."+strconv.Itoa(index)+"."+"rp-candidate"+"."+strconv.Itoa(cindex)+"."+"bidir", map[string]string{})
						}
					}
				}
			}
		}
	}
	return body
}

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

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

func (data *PIM) 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-multicast:autorp-container.autorp"); !data.Autorp.IsNull() {
		if value.Exists() {
			data.Autorp = types.BoolValue(value.Bool())
		}
	} else {
		data.Autorp = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:autorp-container.listener"); !data.AutorpListener.IsNull() {
		if value.Exists() {
			data.AutorpListener = types.BoolValue(true)
		} else {
			data.AutorpListener = types.BoolValue(false)
		}
	} else {
		data.AutorpListener = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.Loopback"); value.Exists() && !data.BsrCandidateLoopback.IsNull() {
		data.BsrCandidateLoopback = types.Int64Value(value.Int())
	} else {
		data.BsrCandidateLoopback = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.mask"); value.Exists() && !data.BsrCandidateMask.IsNull() {
		data.BsrCandidateMask = types.Int64Value(value.Int())
	} else {
		data.BsrCandidateMask = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.priority"); value.Exists() && !data.BsrCandidatePriority.IsNull() {
		data.BsrCandidatePriority = types.Int64Value(value.Int())
	} else {
		data.BsrCandidatePriority = types.Int64Null()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.accept-rp-candidate"); value.Exists() && !data.BsrCandidateAcceptRpCandidate.IsNull() {
		data.BsrCandidateAcceptRpCandidate = types.StringValue(value.String())
	} else {
		data.BsrCandidateAcceptRpCandidate = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:ssm.range"); value.Exists() && !data.SsmRange.IsNull() {
		data.SsmRange = types.StringValue(value.String())
	} else {
		data.SsmRange = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:ssm.default"); !data.SsmDefault.IsNull() {
		if value.Exists() {
			data.SsmDefault = types.BoolValue(true)
		} else {
			data.SsmDefault = types.BoolValue(false)
		}
	} else {
		data.SsmDefault = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.address"); value.Exists() && !data.RpAddress.IsNull() {
		data.RpAddress = types.StringValue(value.String())
	} else {
		data.RpAddress = types.StringNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.override"); !data.RpAddressOverride.IsNull() {
		if value.Exists() {
			data.RpAddressOverride = types.BoolValue(true)
		} else {
			data.RpAddressOverride = types.BoolValue(false)
		}
	} else {
		data.RpAddressOverride = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.bidir"); !data.RpAddressBidir.IsNull() {
		if value.Exists() {
			data.RpAddressBidir = types.BoolValue(true)
		} else {
			data.RpAddressBidir = types.BoolValue(false)
		}
	} else {
		data.RpAddressBidir = types.BoolNull()
	}
	for i := range data.RpAddresses {
		keys := [...]string{"access-list"}
		keyValues := [...]string{data.RpAddresses[i].AccessList.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-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("access-list"); value.Exists() && !data.RpAddresses[i].AccessList.IsNull() {
			data.RpAddresses[i].AccessList = types.StringValue(value.String())
		} else {
			data.RpAddresses[i].AccessList = types.StringNull()
		}
		if value := r.Get("rp-address"); value.Exists() && !data.RpAddresses[i].RpAddress.IsNull() {
			data.RpAddresses[i].RpAddress = types.StringValue(value.String())
		} else {
			data.RpAddresses[i].RpAddress = types.StringNull()
		}
		if value := r.Get("override"); !data.RpAddresses[i].Override.IsNull() {
			if value.Exists() {
				data.RpAddresses[i].Override = types.BoolValue(true)
			} else {
				data.RpAddresses[i].Override = types.BoolValue(false)
			}
		} else {
			data.RpAddresses[i].Override = types.BoolNull()
		}
		if value := r.Get("bidir"); !data.RpAddresses[i].Bidir.IsNull() {
			if value.Exists() {
				data.RpAddresses[i].Bidir = types.BoolValue(true)
			} else {
				data.RpAddresses[i].Bidir = types.BoolValue(false)
			}
		} else {
			data.RpAddresses[i].Bidir = types.BoolNull()
		}
	}
	for i := range data.RpCandidates {
		keys := [...]string{"interface"}
		keyValues := [...]string{data.RpCandidates[i].Interface.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-multicast:rp-candidate").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("interface"); value.Exists() && !data.RpCandidates[i].Interface.IsNull() {
			data.RpCandidates[i].Interface = types.StringValue(value.String())
		} else {
			data.RpCandidates[i].Interface = types.StringNull()
		}
		if value := r.Get("group-list"); value.Exists() && !data.RpCandidates[i].GroupList.IsNull() {
			data.RpCandidates[i].GroupList = types.StringValue(value.String())
		} else {
			data.RpCandidates[i].GroupList = types.StringNull()
		}
		if value := r.Get("interval"); value.Exists() && !data.RpCandidates[i].Interval.IsNull() {
			data.RpCandidates[i].Interval = types.Int64Value(value.Int())
		} else {
			data.RpCandidates[i].Interval = types.Int64Null()
		}
		if value := r.Get("priority"); value.Exists() && !data.RpCandidates[i].Priority.IsNull() {
			data.RpCandidates[i].Priority = types.Int64Value(value.Int())
		} else {
			data.RpCandidates[i].Priority = types.Int64Null()
		}
		if value := r.Get("bidir"); !data.RpCandidates[i].Bidir.IsNull() {
			if value.Exists() {
				data.RpCandidates[i].Bidir = types.BoolValue(true)
			} else {
				data.RpCandidates[i].Bidir = types.BoolValue(false)
			}
		} else {
			data.RpCandidates[i].Bidir = types.BoolNull()
		}
	}
	for i := range data.Vrfs {
		keys := [...]string{"id"}
		keyValues := [...]string{data.Vrfs[i].Vrf.ValueString()}

		var r gjson.Result
		res.Get(prefix + "Cisco-IOS-XE-multicast: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("id"); value.Exists() && !data.Vrfs[i].Vrf.IsNull() {
			data.Vrfs[i].Vrf = types.StringValue(value.String())
		} else {
			data.Vrfs[i].Vrf = types.StringNull()
		}
		if value := r.Get("autorp-container.autorp"); !data.Vrfs[i].Autorp.IsNull() {
			if value.Exists() {
				data.Vrfs[i].Autorp = types.BoolValue(value.Bool())
			}
		} else {
			data.Vrfs[i].Autorp = types.BoolNull()
		}
		if value := r.Get("autorp-container.listener"); !data.Vrfs[i].AutorpListener.IsNull() {
			if value.Exists() {
				data.Vrfs[i].AutorpListener = types.BoolValue(true)
			} else {
				data.Vrfs[i].AutorpListener = types.BoolValue(false)
			}
		} else {
			data.Vrfs[i].AutorpListener = types.BoolNull()
		}
		if value := r.Get("bsr-candidate.Loopback"); value.Exists() && !data.Vrfs[i].BsrCandidateLoopback.IsNull() {
			data.Vrfs[i].BsrCandidateLoopback = types.Int64Value(value.Int())
		} else {
			data.Vrfs[i].BsrCandidateLoopback = types.Int64Null()
		}
		if value := r.Get("bsr-candidate.mask"); value.Exists() && !data.Vrfs[i].BsrCandidateMask.IsNull() {
			data.Vrfs[i].BsrCandidateMask = types.Int64Value(value.Int())
		} else {
			data.Vrfs[i].BsrCandidateMask = types.Int64Null()
		}
		if value := r.Get("bsr-candidate.priority"); value.Exists() && !data.Vrfs[i].BsrCandidatePriority.IsNull() {
			data.Vrfs[i].BsrCandidatePriority = types.Int64Value(value.Int())
		} else {
			data.Vrfs[i].BsrCandidatePriority = types.Int64Null()
		}
		if value := r.Get("bsr-candidate.accept-rp-candidate"); value.Exists() && !data.Vrfs[i].BsrCandidateAcceptRpCandidate.IsNull() {
			data.Vrfs[i].BsrCandidateAcceptRpCandidate = types.StringValue(value.String())
		} else {
			data.Vrfs[i].BsrCandidateAcceptRpCandidate = types.StringNull()
		}
		if value := r.Get("ssm.range"); value.Exists() && !data.Vrfs[i].SsmRange.IsNull() {
			data.Vrfs[i].SsmRange = types.StringValue(value.String())
		} else {
			data.Vrfs[i].SsmRange = types.StringNull()
		}
		if value := r.Get("ssm.default"); !data.Vrfs[i].SsmDefault.IsNull() {
			if value.Exists() {
				data.Vrfs[i].SsmDefault = types.BoolValue(true)
			} else {
				data.Vrfs[i].SsmDefault = types.BoolValue(false)
			}
		} else {
			data.Vrfs[i].SsmDefault = types.BoolNull()
		}
		if value := r.Get("rp-address-conf.address"); value.Exists() && !data.Vrfs[i].RpAddress.IsNull() {
			data.Vrfs[i].RpAddress = types.StringValue(value.String())
		} else {
			data.Vrfs[i].RpAddress = types.StringNull()
		}
		if value := r.Get("rp-address-conf.override"); !data.Vrfs[i].RpAddressOverride.IsNull() {
			if value.Exists() {
				data.Vrfs[i].RpAddressOverride = types.BoolValue(true)
			} else {
				data.Vrfs[i].RpAddressOverride = types.BoolValue(false)
			}
		} else {
			data.Vrfs[i].RpAddressOverride = types.BoolNull()
		}
		if value := r.Get("rp-address-conf.bidir"); !data.Vrfs[i].RpAddressBidir.IsNull() {
			if value.Exists() {
				data.Vrfs[i].RpAddressBidir = types.BoolValue(true)
			} else {
				data.Vrfs[i].RpAddressBidir = types.BoolValue(false)
			}
		} else {
			data.Vrfs[i].RpAddressBidir = types.BoolNull()
		}
		if value := r.Get("cache.rpf-oif"); !data.Vrfs[i].CacheRpfOif.IsNull() {
			if value.Exists() {
				data.Vrfs[i].CacheRpfOif = types.BoolValue(true)
			} else {
				data.Vrfs[i].CacheRpfOif = types.BoolValue(false)
			}
		} else {
			data.Vrfs[i].CacheRpfOif = types.BoolNull()
		}
		for ci := range data.Vrfs[i].RpAddresses {
			keys := [...]string{"access-list"}
			keyValues := [...]string{data.Vrfs[i].RpAddresses[ci].AccessList.ValueString()}

			var cr gjson.Result
			r.Get("rp-address-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("access-list"); value.Exists() && !data.Vrfs[i].RpAddresses[ci].AccessList.IsNull() {
				data.Vrfs[i].RpAddresses[ci].AccessList = types.StringValue(value.String())
			} else {
				data.Vrfs[i].RpAddresses[ci].AccessList = types.StringNull()
			}
			if value := cr.Get("rp-address"); value.Exists() && !data.Vrfs[i].RpAddresses[ci].RpAddress.IsNull() {
				data.Vrfs[i].RpAddresses[ci].RpAddress = types.StringValue(value.String())
			} else {
				data.Vrfs[i].RpAddresses[ci].RpAddress = types.StringNull()
			}
			if value := cr.Get("override"); !data.Vrfs[i].RpAddresses[ci].Override.IsNull() {
				if value.Exists() {
					data.Vrfs[i].RpAddresses[ci].Override = types.BoolValue(true)
				} else {
					data.Vrfs[i].RpAddresses[ci].Override = types.BoolValue(false)
				}
			} else {
				data.Vrfs[i].RpAddresses[ci].Override = types.BoolNull()
			}
			if value := cr.Get("bidir"); !data.Vrfs[i].RpAddresses[ci].Bidir.IsNull() {
				if value.Exists() {
					data.Vrfs[i].RpAddresses[ci].Bidir = types.BoolValue(true)
				} else {
					data.Vrfs[i].RpAddresses[ci].Bidir = types.BoolValue(false)
				}
			} else {
				data.Vrfs[i].RpAddresses[ci].Bidir = types.BoolNull()
			}
		}
		for ci := range data.Vrfs[i].RpCandidates {
			keys := [...]string{"interface"}
			keyValues := [...]string{data.Vrfs[i].RpCandidates[ci].Interface.ValueString()}

			var cr gjson.Result
			r.Get("rp-candidate").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("interface"); value.Exists() && !data.Vrfs[i].RpCandidates[ci].Interface.IsNull() {
				data.Vrfs[i].RpCandidates[ci].Interface = types.StringValue(value.String())
			} else {
				data.Vrfs[i].RpCandidates[ci].Interface = types.StringNull()
			}
			if value := cr.Get("group-list"); value.Exists() && !data.Vrfs[i].RpCandidates[ci].GroupList.IsNull() {
				data.Vrfs[i].RpCandidates[ci].GroupList = types.StringValue(value.String())
			} else {
				data.Vrfs[i].RpCandidates[ci].GroupList = types.StringNull()
			}
			if value := cr.Get("interval"); value.Exists() && !data.Vrfs[i].RpCandidates[ci].Interval.IsNull() {
				data.Vrfs[i].RpCandidates[ci].Interval = types.Int64Value(value.Int())
			} else {
				data.Vrfs[i].RpCandidates[ci].Interval = types.Int64Null()
			}
			if value := cr.Get("priority"); value.Exists() && !data.Vrfs[i].RpCandidates[ci].Priority.IsNull() {
				data.Vrfs[i].RpCandidates[ci].Priority = types.Int64Value(value.Int())
			} else {
				data.Vrfs[i].RpCandidates[ci].Priority = types.Int64Null()
			}
			if value := cr.Get("bidir"); !data.Vrfs[i].RpCandidates[ci].Bidir.IsNull() {
				if value.Exists() {
					data.Vrfs[i].RpCandidates[ci].Bidir = types.BoolValue(true)
				} else {
					data.Vrfs[i].RpCandidates[ci].Bidir = types.BoolValue(false)
				}
			} else {
				data.Vrfs[i].RpCandidates[ci].Bidir = types.BoolNull()
			}
		}
	}
}

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

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

func (data *PIM) 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-multicast:autorp-container.autorp"); value.Exists() {
		data.Autorp = types.BoolValue(value.Bool())
	} else {
		data.Autorp = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:autorp-container.listener"); value.Exists() {
		data.AutorpListener = types.BoolValue(true)
	} else {
		data.AutorpListener = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.Loopback"); value.Exists() {
		data.BsrCandidateLoopback = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.mask"); value.Exists() {
		data.BsrCandidateMask = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.priority"); value.Exists() {
		data.BsrCandidatePriority = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.accept-rp-candidate"); value.Exists() {
		data.BsrCandidateAcceptRpCandidate = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:ssm.range"); value.Exists() {
		data.SsmRange = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:ssm.default"); value.Exists() {
		data.SsmDefault = types.BoolValue(true)
	} else {
		data.SsmDefault = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.address"); value.Exists() {
		data.RpAddress = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.override"); value.Exists() {
		data.RpAddressOverride = types.BoolValue(true)
	} else {
		data.RpAddressOverride = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.bidir"); value.Exists() {
		data.RpAddressBidir = types.BoolValue(true)
	} else {
		data.RpAddressBidir = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-list"); value.Exists() {
		data.RpAddresses = make([]PIMRpAddresses, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := PIMRpAddresses{}
			if cValue := v.Get("access-list"); cValue.Exists() {
				item.AccessList = types.StringValue(cValue.String())
			}
			if cValue := v.Get("rp-address"); cValue.Exists() {
				item.RpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("override"); cValue.Exists() {
				item.Override = types.BoolValue(true)
			} else {
				item.Override = types.BoolValue(false)
			}
			if cValue := v.Get("bidir"); cValue.Exists() {
				item.Bidir = types.BoolValue(true)
			} else {
				item.Bidir = types.BoolValue(false)
			}
			data.RpAddresses = append(data.RpAddresses, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-candidate"); value.Exists() {
		data.RpCandidates = make([]PIMRpCandidates, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := PIMRpCandidates{}
			if cValue := v.Get("interface"); cValue.Exists() {
				item.Interface = types.StringValue(cValue.String())
			}
			if cValue := v.Get("group-list"); cValue.Exists() {
				item.GroupList = types.StringValue(cValue.String())
			}
			if cValue := v.Get("interval"); cValue.Exists() {
				item.Interval = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("priority"); cValue.Exists() {
				item.Priority = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bidir"); cValue.Exists() {
				item.Bidir = types.BoolValue(true)
			} else {
				item.Bidir = types.BoolValue(false)
			}
			data.RpCandidates = append(data.RpCandidates, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:vrf"); value.Exists() {
		data.Vrfs = make([]PIMVrfs, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := PIMVrfs{}
			if cValue := v.Get("id"); cValue.Exists() {
				item.Vrf = types.StringValue(cValue.String())
			}
			if cValue := v.Get("autorp-container.autorp"); cValue.Exists() {
				item.Autorp = types.BoolValue(cValue.Bool())
			} else {
				item.Autorp = types.BoolNull()
			}
			if cValue := v.Get("autorp-container.listener"); cValue.Exists() {
				item.AutorpListener = types.BoolValue(true)
			} else {
				item.AutorpListener = types.BoolValue(false)
			}
			if cValue := v.Get("bsr-candidate.Loopback"); cValue.Exists() {
				item.BsrCandidateLoopback = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bsr-candidate.mask"); cValue.Exists() {
				item.BsrCandidateMask = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bsr-candidate.priority"); cValue.Exists() {
				item.BsrCandidatePriority = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bsr-candidate.accept-rp-candidate"); cValue.Exists() {
				item.BsrCandidateAcceptRpCandidate = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ssm.range"); cValue.Exists() {
				item.SsmRange = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ssm.default"); cValue.Exists() {
				item.SsmDefault = types.BoolValue(true)
			} else {
				item.SsmDefault = types.BoolValue(false)
			}
			if cValue := v.Get("rp-address-conf.address"); cValue.Exists() {
				item.RpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("rp-address-conf.override"); cValue.Exists() {
				item.RpAddressOverride = types.BoolValue(true)
			} else {
				item.RpAddressOverride = types.BoolValue(false)
			}
			if cValue := v.Get("rp-address-conf.bidir"); cValue.Exists() {
				item.RpAddressBidir = types.BoolValue(true)
			} else {
				item.RpAddressBidir = types.BoolValue(false)
			}
			if cValue := v.Get("cache.rpf-oif"); cValue.Exists() {
				item.CacheRpfOif = types.BoolValue(true)
			} else {
				item.CacheRpfOif = types.BoolValue(false)
			}
			if cValue := v.Get("rp-address-list"); cValue.Exists() {
				item.RpAddresses = make([]PIMVrfsRpAddresses, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := PIMVrfsRpAddresses{}
					if ccValue := cv.Get("access-list"); ccValue.Exists() {
						cItem.AccessList = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("rp-address"); ccValue.Exists() {
						cItem.RpAddress = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("override"); ccValue.Exists() {
						cItem.Override = types.BoolValue(true)
					} else {
						cItem.Override = types.BoolValue(false)
					}
					if ccValue := cv.Get("bidir"); ccValue.Exists() {
						cItem.Bidir = types.BoolValue(true)
					} else {
						cItem.Bidir = types.BoolValue(false)
					}
					item.RpAddresses = append(item.RpAddresses, cItem)
					return true
				})
			}
			if cValue := v.Get("rp-candidate"); cValue.Exists() {
				item.RpCandidates = make([]PIMVrfsRpCandidates, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := PIMVrfsRpCandidates{}
					if ccValue := cv.Get("interface"); ccValue.Exists() {
						cItem.Interface = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("group-list"); ccValue.Exists() {
						cItem.GroupList = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("interval"); ccValue.Exists() {
						cItem.Interval = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("priority"); ccValue.Exists() {
						cItem.Priority = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("bidir"); ccValue.Exists() {
						cItem.Bidir = types.BoolValue(true)
					} else {
						cItem.Bidir = types.BoolValue(false)
					}
					item.RpCandidates = append(item.RpCandidates, cItem)
					return true
				})
			}
			data.Vrfs = append(data.Vrfs, item)
			return true
		})
	}
}

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

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

func (data *PIMData) 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-multicast:autorp-container.autorp"); value.Exists() {
		data.Autorp = types.BoolValue(value.Bool())
	} else {
		data.Autorp = types.BoolNull()
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:autorp-container.listener"); value.Exists() {
		data.AutorpListener = types.BoolValue(true)
	} else {
		data.AutorpListener = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.Loopback"); value.Exists() {
		data.BsrCandidateLoopback = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.mask"); value.Exists() {
		data.BsrCandidateMask = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.priority"); value.Exists() {
		data.BsrCandidatePriority = types.Int64Value(value.Int())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:bsr-candidate.accept-rp-candidate"); value.Exists() {
		data.BsrCandidateAcceptRpCandidate = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:ssm.range"); value.Exists() {
		data.SsmRange = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:ssm.default"); value.Exists() {
		data.SsmDefault = types.BoolValue(true)
	} else {
		data.SsmDefault = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.address"); value.Exists() {
		data.RpAddress = types.StringValue(value.String())
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.override"); value.Exists() {
		data.RpAddressOverride = types.BoolValue(true)
	} else {
		data.RpAddressOverride = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-conf.bidir"); value.Exists() {
		data.RpAddressBidir = types.BoolValue(true)
	} else {
		data.RpAddressBidir = types.BoolValue(false)
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-address-list"); value.Exists() {
		data.RpAddresses = make([]PIMRpAddresses, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := PIMRpAddresses{}
			if cValue := v.Get("access-list"); cValue.Exists() {
				item.AccessList = types.StringValue(cValue.String())
			}
			if cValue := v.Get("rp-address"); cValue.Exists() {
				item.RpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("override"); cValue.Exists() {
				item.Override = types.BoolValue(true)
			} else {
				item.Override = types.BoolValue(false)
			}
			if cValue := v.Get("bidir"); cValue.Exists() {
				item.Bidir = types.BoolValue(true)
			} else {
				item.Bidir = types.BoolValue(false)
			}
			data.RpAddresses = append(data.RpAddresses, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:rp-candidate"); value.Exists() {
		data.RpCandidates = make([]PIMRpCandidates, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := PIMRpCandidates{}
			if cValue := v.Get("interface"); cValue.Exists() {
				item.Interface = types.StringValue(cValue.String())
			}
			if cValue := v.Get("group-list"); cValue.Exists() {
				item.GroupList = types.StringValue(cValue.String())
			}
			if cValue := v.Get("interval"); cValue.Exists() {
				item.Interval = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("priority"); cValue.Exists() {
				item.Priority = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bidir"); cValue.Exists() {
				item.Bidir = types.BoolValue(true)
			} else {
				item.Bidir = types.BoolValue(false)
			}
			data.RpCandidates = append(data.RpCandidates, item)
			return true
		})
	}
	if value := res.Get(prefix + "Cisco-IOS-XE-multicast:vrf"); value.Exists() {
		data.Vrfs = make([]PIMVrfs, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := PIMVrfs{}
			if cValue := v.Get("id"); cValue.Exists() {
				item.Vrf = types.StringValue(cValue.String())
			}
			if cValue := v.Get("autorp-container.autorp"); cValue.Exists() {
				item.Autorp = types.BoolValue(cValue.Bool())
			} else {
				item.Autorp = types.BoolNull()
			}
			if cValue := v.Get("autorp-container.listener"); cValue.Exists() {
				item.AutorpListener = types.BoolValue(true)
			} else {
				item.AutorpListener = types.BoolValue(false)
			}
			if cValue := v.Get("bsr-candidate.Loopback"); cValue.Exists() {
				item.BsrCandidateLoopback = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bsr-candidate.mask"); cValue.Exists() {
				item.BsrCandidateMask = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bsr-candidate.priority"); cValue.Exists() {
				item.BsrCandidatePriority = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("bsr-candidate.accept-rp-candidate"); cValue.Exists() {
				item.BsrCandidateAcceptRpCandidate = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ssm.range"); cValue.Exists() {
				item.SsmRange = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ssm.default"); cValue.Exists() {
				item.SsmDefault = types.BoolValue(true)
			} else {
				item.SsmDefault = types.BoolValue(false)
			}
			if cValue := v.Get("rp-address-conf.address"); cValue.Exists() {
				item.RpAddress = types.StringValue(cValue.String())
			}
			if cValue := v.Get("rp-address-conf.override"); cValue.Exists() {
				item.RpAddressOverride = types.BoolValue(true)
			} else {
				item.RpAddressOverride = types.BoolValue(false)
			}
			if cValue := v.Get("rp-address-conf.bidir"); cValue.Exists() {
				item.RpAddressBidir = types.BoolValue(true)
			} else {
				item.RpAddressBidir = types.BoolValue(false)
			}
			if cValue := v.Get("cache.rpf-oif"); cValue.Exists() {
				item.CacheRpfOif = types.BoolValue(true)
			} else {
				item.CacheRpfOif = types.BoolValue(false)
			}
			if cValue := v.Get("rp-address-list"); cValue.Exists() {
				item.RpAddresses = make([]PIMVrfsRpAddresses, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := PIMVrfsRpAddresses{}
					if ccValue := cv.Get("access-list"); ccValue.Exists() {
						cItem.AccessList = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("rp-address"); ccValue.Exists() {
						cItem.RpAddress = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("override"); ccValue.Exists() {
						cItem.Override = types.BoolValue(true)
					} else {
						cItem.Override = types.BoolValue(false)
					}
					if ccValue := cv.Get("bidir"); ccValue.Exists() {
						cItem.Bidir = types.BoolValue(true)
					} else {
						cItem.Bidir = types.BoolValue(false)
					}
					item.RpAddresses = append(item.RpAddresses, cItem)
					return true
				})
			}
			if cValue := v.Get("rp-candidate"); cValue.Exists() {
				item.RpCandidates = make([]PIMVrfsRpCandidates, 0)
				cValue.ForEach(func(ck, cv gjson.Result) bool {
					cItem := PIMVrfsRpCandidates{}
					if ccValue := cv.Get("interface"); ccValue.Exists() {
						cItem.Interface = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("group-list"); ccValue.Exists() {
						cItem.GroupList = types.StringValue(ccValue.String())
					}
					if ccValue := cv.Get("interval"); ccValue.Exists() {
						cItem.Interval = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("priority"); ccValue.Exists() {
						cItem.Priority = types.Int64Value(ccValue.Int())
					}
					if ccValue := cv.Get("bidir"); ccValue.Exists() {
						cItem.Bidir = types.BoolValue(true)
					} else {
						cItem.Bidir = types.BoolValue(false)
					}
					item.RpCandidates = append(item.RpCandidates, cItem)
					return true
				})
			}
			data.Vrfs = append(data.Vrfs, item)
			return true
		})
	}
}

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

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

func (data *PIM) getDeletedItems(ctx context.Context, state PIM) []string {
	deletedItems := make([]string, 0)
	for i := range state.Vrfs {
		stateKeyValues := [...]string{state.Vrfs[i].Vrf.ValueString()}

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

		found := false
		for j := range data.Vrfs {
			found = true
			if state.Vrfs[i].Vrf.ValueString() != data.Vrfs[j].Vrf.ValueString() {
				found = false
			}
			if found {
				for ci := range state.Vrfs[i].RpCandidates {
					cstateKeyValues := [...]string{state.Vrfs[i].RpCandidates[ci].Interface.ValueString()}

					cemptyKeys := true
					if !reflect.ValueOf(state.Vrfs[i].RpCandidates[ci].Interface.ValueString()).IsZero() {
						cemptyKeys = false
					}
					if cemptyKeys {
						continue
					}

					found := false
					for cj := range data.Vrfs[j].RpCandidates {
						found = true
						if state.Vrfs[i].RpCandidates[ci].Interface.ValueString() != data.Vrfs[j].RpCandidates[cj].Interface.ValueString() {
							found = false
						}
						if found {
							if !state.Vrfs[i].RpCandidates[ci].Bidir.IsNull() && data.Vrfs[j].RpCandidates[cj].Bidir.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-candidate=%v/bidir", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.Vrfs[i].RpCandidates[ci].Priority.IsNull() && data.Vrfs[j].RpCandidates[cj].Priority.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-candidate=%v/priority", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.Vrfs[i].RpCandidates[ci].Interval.IsNull() && data.Vrfs[j].RpCandidates[cj].Interval.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-candidate=%v/interval", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.Vrfs[i].RpCandidates[ci].GroupList.IsNull() && data.Vrfs[j].RpCandidates[cj].GroupList.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-candidate=%v/group-list", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							break
						}
					}
					if !found {
						deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-candidate=%v", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
					}
				}
				for ci := range state.Vrfs[i].RpAddresses {
					cstateKeyValues := [...]string{state.Vrfs[i].RpAddresses[ci].AccessList.ValueString()}

					cemptyKeys := true
					if !reflect.ValueOf(state.Vrfs[i].RpAddresses[ci].AccessList.ValueString()).IsZero() {
						cemptyKeys = false
					}
					if cemptyKeys {
						continue
					}

					found := false
					for cj := range data.Vrfs[j].RpAddresses {
						found = true
						if state.Vrfs[i].RpAddresses[ci].AccessList.ValueString() != data.Vrfs[j].RpAddresses[cj].AccessList.ValueString() {
							found = false
						}
						if found {
							if !state.Vrfs[i].RpAddresses[ci].Bidir.IsNull() && data.Vrfs[j].RpAddresses[cj].Bidir.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-list=%v/bidir", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.Vrfs[i].RpAddresses[ci].Override.IsNull() && data.Vrfs[j].RpAddresses[cj].Override.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-list=%v/override", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							if !state.Vrfs[i].RpAddresses[ci].RpAddress.IsNull() && data.Vrfs[j].RpAddresses[cj].RpAddress.IsNull() {
								deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-list=%v/rp-address", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
							}
							break
						}
					}
					if !found {
						deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-list=%v", state.getPath(), strings.Join(stateKeyValues[:], ","), strings.Join(cstateKeyValues[:], ",")))
					}
				}
				if !state.Vrfs[i].RpAddressBidir.IsNull() && data.Vrfs[j].RpAddressBidir.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-conf/bidir", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].RpAddressOverride.IsNull() && data.Vrfs[j].RpAddressOverride.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-conf/override", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].RpAddress.IsNull() && data.Vrfs[j].RpAddress.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-conf/address", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].SsmDefault.IsNull() && data.Vrfs[j].SsmDefault.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/ssm/default", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].SsmRange.IsNull() && data.Vrfs[j].SsmRange.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/ssm/range", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].BsrCandidateAcceptRpCandidate.IsNull() && data.Vrfs[j].BsrCandidateAcceptRpCandidate.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/bsr-candidate", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].BsrCandidatePriority.IsNull() && data.Vrfs[j].BsrCandidatePriority.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/bsr-candidate", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].BsrCandidateMask.IsNull() && data.Vrfs[j].BsrCandidateMask.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/bsr-candidate", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].BsrCandidateLoopback.IsNull() && data.Vrfs[j].BsrCandidateLoopback.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/bsr-candidate", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].AutorpListener.IsNull() && data.Vrfs[j].AutorpListener.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/autorp-container/listener", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Vrfs[i].Autorp.IsNull() && data.Vrfs[j].Autorp.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/autorp-container/autorp", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.RpCandidates {
		stateKeyValues := [...]string{state.RpCandidates[i].Interface.ValueString()}

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

		found := false
		for j := range data.RpCandidates {
			found = true
			if state.RpCandidates[i].Interface.ValueString() != data.RpCandidates[j].Interface.ValueString() {
				found = false
			}
			if found {
				if !state.RpCandidates[i].Bidir.IsNull() && data.RpCandidates[j].Bidir.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v/bidir", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.RpCandidates[i].Priority.IsNull() && data.RpCandidates[j].Priority.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v/priority", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.RpCandidates[i].Interval.IsNull() && data.RpCandidates[j].Interval.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v/interval", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.RpCandidates[i].GroupList.IsNull() && data.RpCandidates[j].GroupList.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v/group-list", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	for i := range state.RpAddresses {
		stateKeyValues := [...]string{state.RpAddresses[i].AccessList.ValueString()}

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

		found := false
		for j := range data.RpAddresses {
			found = true
			if state.RpAddresses[i].AccessList.ValueString() != data.RpAddresses[j].AccessList.ValueString() {
				found = false
			}
			if found {
				if !state.RpAddresses[i].Bidir.IsNull() && data.RpAddresses[j].Bidir.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v/bidir", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.RpAddresses[i].Override.IsNull() && data.RpAddresses[j].Override.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v/override", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.RpAddresses[i].RpAddress.IsNull() && data.RpAddresses[j].RpAddress.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v/rp-address", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v", state.getPath(), strings.Join(stateKeyValues[:], ",")))
		}
	}
	if !state.RpAddressBidir.IsNull() && data.RpAddressBidir.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/bidir", state.getPath()))
	}
	if !state.RpAddressOverride.IsNull() && data.RpAddressOverride.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/override", state.getPath()))
	}
	if !state.RpAddress.IsNull() && data.RpAddress.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/address", state.getPath()))
	}
	if !state.SsmDefault.IsNull() && data.SsmDefault.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:ssm/default", state.getPath()))
	}
	if !state.SsmRange.IsNull() && data.SsmRange.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:ssm/range", state.getPath()))
	}
	if !state.BsrCandidateAcceptRpCandidate.IsNull() && data.BsrCandidateAcceptRpCandidate.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", state.getPath()))
	}
	if !state.BsrCandidatePriority.IsNull() && data.BsrCandidatePriority.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", state.getPath()))
	}
	if !state.BsrCandidateMask.IsNull() && data.BsrCandidateMask.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", state.getPath()))
	}
	if !state.BsrCandidateLoopback.IsNull() && data.BsrCandidateLoopback.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", state.getPath()))
	}
	if !state.AutorpListener.IsNull() && data.AutorpListener.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:autorp-container/listener", state.getPath()))
	}
	if !state.Autorp.IsNull() && data.Autorp.IsNull() {
		deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:autorp-container/autorp", state.getPath()))
	}

	return deletedItems
}

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

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

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

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

		for ci := range data.Vrfs[i].RpCandidates {
			ckeyValues := [...]string{data.Vrfs[i].RpCandidates[ci].Interface.ValueString()}
			if !data.Vrfs[i].RpCandidates[ci].Bidir.IsNull() && !data.Vrfs[i].RpCandidates[ci].Bidir.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-candidate=%v/bidir", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
		}

		for ci := range data.Vrfs[i].RpAddresses {
			ckeyValues := [...]string{data.Vrfs[i].RpAddresses[ci].AccessList.ValueString()}
			if !data.Vrfs[i].RpAddresses[ci].Bidir.IsNull() && !data.Vrfs[i].RpAddresses[ci].Bidir.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-list=%v/bidir", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
			if !data.Vrfs[i].RpAddresses[ci].Override.IsNull() && !data.Vrfs[i].RpAddresses[ci].Override.ValueBool() {
				emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-list=%v/override", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ",")))
			}
		}
		if !data.Vrfs[i].CacheRpfOif.IsNull() && !data.Vrfs[i].CacheRpfOif.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/cache/rpf-oif", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Vrfs[i].RpAddressBidir.IsNull() && !data.Vrfs[i].RpAddressBidir.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-conf/bidir", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Vrfs[i].RpAddressOverride.IsNull() && !data.Vrfs[i].RpAddressOverride.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/rp-address-conf/override", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Vrfs[i].SsmDefault.IsNull() && !data.Vrfs[i].SsmDefault.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/ssm/default", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Vrfs[i].AutorpListener.IsNull() && !data.Vrfs[i].AutorpListener.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:vrf=%v/autorp-container/listener", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}

	for i := range data.RpCandidates {
		keyValues := [...]string{data.RpCandidates[i].Interface.ValueString()}
		if !data.RpCandidates[i].Bidir.IsNull() && !data.RpCandidates[i].Bidir.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v/bidir", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}

	for i := range data.RpAddresses {
		keyValues := [...]string{data.RpAddresses[i].AccessList.ValueString()}
		if !data.RpAddresses[i].Bidir.IsNull() && !data.RpAddresses[i].Bidir.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v/bidir", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.RpAddresses[i].Override.IsNull() && !data.RpAddresses[i].Override.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v/override", data.getPath(), strings.Join(keyValues[:], ",")))
		}
	}
	if !data.RpAddressBidir.IsNull() && !data.RpAddressBidir.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/bidir", data.getPath()))
	}
	if !data.RpAddressOverride.IsNull() && !data.RpAddressOverride.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/override", data.getPath()))
	}
	if !data.SsmDefault.IsNull() && !data.SsmDefault.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:ssm/default", data.getPath()))
	}
	if !data.AutorpListener.IsNull() && !data.AutorpListener.ValueBool() {
		emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:autorp-container/listener", data.getPath()))
	}

	return emptyLeafsDelete
}

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

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

func (data *PIM) getDeletePaths(ctx context.Context) []string {
	var deletePaths []string
	for i := range data.Vrfs {
		keyValues := [...]string{data.Vrfs[i].Vrf.ValueString()}

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

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-candidate=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	for i := range data.RpAddresses {
		keyValues := [...]string{data.RpAddresses[i].AccessList.ValueString()}

		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-list=%v", data.getPath(), strings.Join(keyValues[:], ",")))
	}
	if !data.RpAddressBidir.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/bidir", data.getPath()))
	}
	if !data.RpAddressOverride.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/override", data.getPath()))
	}
	if !data.RpAddress.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:rp-address-conf/address", data.getPath()))
	}
	if !data.SsmDefault.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:ssm/default", data.getPath()))
	}
	if !data.SsmRange.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:ssm/range", data.getPath()))
	}
	if !data.BsrCandidateAcceptRpCandidate.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", data.getPath()))
	}
	if !data.BsrCandidatePriority.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", data.getPath()))
	}
	if !data.BsrCandidateMask.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", data.getPath()))
	}
	if !data.BsrCandidateLoopback.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:bsr-candidate", data.getPath()))
	}
	if !data.AutorpListener.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:autorp-container/listener", data.getPath()))
	}
	if !data.Autorp.IsNull() {
		deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-multicast:autorp-container/autorp", data.getPath()))
	}

	return deletePaths
}

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