// 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"
	"net/url"
	"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 AccessListRoleBased struct {
	Device  types.String                 `tfsdk:"device"`
	Id      types.String                 `tfsdk:"id"`
	Name    types.String                 `tfsdk:"name"`
	Entries []AccessListRoleBasedEntries `tfsdk:"entries"`
}

type AccessListRoleBasedData struct {
	Device  types.String                 `tfsdk:"device"`
	Id      types.String                 `tfsdk:"id"`
	Name    types.String                 `tfsdk:"name"`
	Entries []AccessListRoleBasedEntries `tfsdk:"entries"`
}
type AccessListRoleBasedEntries struct {
	Sequence         types.Int64  `tfsdk:"sequence"`
	Remark           types.String `tfsdk:"remark"`
	AceRuleAction    types.String `tfsdk:"ace_rule_action"`
	AceRuleProtocol  types.String `tfsdk:"ace_rule_protocol"`
	Ack              types.Bool   `tfsdk:"ack"`
	Fin              types.Bool   `tfsdk:"fin"`
	Psh              types.Bool   `tfsdk:"psh"`
	Rst              types.Bool   `tfsdk:"rst"`
	Syn              types.Bool   `tfsdk:"syn"`
	Urg              types.Bool   `tfsdk:"urg"`
	Established      types.Bool   `tfsdk:"established"`
	Dscp             types.String `tfsdk:"dscp"`
	Fragments        types.Bool   `tfsdk:"fragments"`
	Option           types.String `tfsdk:"option"`
	Precedence       types.String `tfsdk:"precedence"`
	TimeRange        types.String `tfsdk:"time_range"`
	Tos              types.String `tfsdk:"tos"`
	Log              types.Bool   `tfsdk:"log"`
	LogInput         types.Bool   `tfsdk:"log_input"`
	MatchAllPlusack  types.Bool   `tfsdk:"match_all_plusack"`
	MatchAllPlusfin  types.Bool   `tfsdk:"match_all_plusfin"`
	MatchAllPluspsh  types.Bool   `tfsdk:"match_all_pluspsh"`
	MatchAllPlusrst  types.Bool   `tfsdk:"match_all_plusrst"`
	MatchAllPlussyn  types.Bool   `tfsdk:"match_all_plussyn"`
	MatchAllPlusurg  types.Bool   `tfsdk:"match_all_plusurg"`
	MatchAllMinusack types.Bool   `tfsdk:"match_all_minusack"`
	MatchAllMinusfin types.Bool   `tfsdk:"match_all_minusfin"`
	MatchAllMinuspsh types.Bool   `tfsdk:"match_all_minuspsh"`
	MatchAllMinusrst types.Bool   `tfsdk:"match_all_minusrst"`
	MatchAllMinussyn types.Bool   `tfsdk:"match_all_minussyn"`
	MatchAllMinusurg types.Bool   `tfsdk:"match_all_minusurg"`
	MatchAnyPlusack  types.Bool   `tfsdk:"match_any_plusack"`
	MatchAnyPlusfin  types.Bool   `tfsdk:"match_any_plusfin"`
	MatchAnyPluspsh  types.Bool   `tfsdk:"match_any_pluspsh"`
	MatchAnyPlusrst  types.Bool   `tfsdk:"match_any_plusrst"`
	MatchAnyPlussyn  types.Bool   `tfsdk:"match_any_plussyn"`
	MatchAnyPlusurg  types.Bool   `tfsdk:"match_any_plusurg"`
	MatchAnyMinusack types.Bool   `tfsdk:"match_any_minusack"`
	MatchAnyMinusfin types.Bool   `tfsdk:"match_any_minusfin"`
	MatchAnyMinuspsh types.Bool   `tfsdk:"match_any_minuspsh"`
	MatchAnyMinusrst types.Bool   `tfsdk:"match_any_minusrst"`
	MatchAnyMinussyn types.Bool   `tfsdk:"match_any_minussyn"`
	MatchAnyMinusurg types.Bool   `tfsdk:"match_any_minusurg"`
}

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

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

func (data AccessListRoleBased) getPath() string {
	return fmt.Sprintf("Cisco-IOS-XE-native:native/ip/access-list/Cisco-IOS-XE-acl:role-based=%v", url.QueryEscape(fmt.Sprintf("%v", data.Name.ValueString())))
}

func (data AccessListRoleBasedData) getPath() string {
	return fmt.Sprintf("Cisco-IOS-XE-native:native/ip/access-list/Cisco-IOS-XE-acl:role-based=%v", url.QueryEscape(fmt.Sprintf("%v", data.Name.ValueString())))
}

// if last path element has a key -> remove it
func (data AccessListRoleBased) 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 AccessListRoleBased) toBody(ctx context.Context) string {
	body := `{"` + helpers.LastElement(data.getPath()) + `":{}}`
	if !data.Name.IsNull() && !data.Name.IsUnknown() {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"name", data.Name.ValueString())
	}
	if len(data.Entries) > 0 {
		body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule", []interface{}{})
		for index, item := range data.Entries {
			if !item.Sequence.IsNull() && !item.Sequence.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"sequence", strconv.FormatInt(item.Sequence.ValueInt64(), 10))
			}
			if !item.Remark.IsNull() && !item.Remark.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"remark", item.Remark.ValueString())
			}
			if !item.AceRuleAction.IsNull() && !item.AceRuleAction.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.action", item.AceRuleAction.ValueString())
			}
			if !item.AceRuleProtocol.IsNull() && !item.AceRuleProtocol.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.protocol", item.AceRuleProtocol.ValueString())
			}
			if !item.Ack.IsNull() && !item.Ack.IsUnknown() {
				if item.Ack.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.ack", map[string]string{})
				}
			}
			if !item.Fin.IsNull() && !item.Fin.IsUnknown() {
				if item.Fin.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.fin", map[string]string{})
				}
			}
			if !item.Psh.IsNull() && !item.Psh.IsUnknown() {
				if item.Psh.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.psh", map[string]string{})
				}
			}
			if !item.Rst.IsNull() && !item.Rst.IsUnknown() {
				if item.Rst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.rst", map[string]string{})
				}
			}
			if !item.Syn.IsNull() && !item.Syn.IsUnknown() {
				if item.Syn.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.syn", map[string]string{})
				}
			}
			if !item.Urg.IsNull() && !item.Urg.IsUnknown() {
				if item.Urg.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.urg", map[string]string{})
				}
			}
			if !item.Established.IsNull() && !item.Established.IsUnknown() {
				if item.Established.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.established", map[string]string{})
				}
			}
			if !item.Dscp.IsNull() && !item.Dscp.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.dscp", item.Dscp.ValueString())
			}
			if !item.Fragments.IsNull() && !item.Fragments.IsUnknown() {
				if item.Fragments.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.fragments", map[string]string{})
				}
			}
			if !item.Option.IsNull() && !item.Option.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.option", item.Option.ValueString())
			}
			if !item.Precedence.IsNull() && !item.Precedence.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.precedence", item.Precedence.ValueString())
			}
			if !item.TimeRange.IsNull() && !item.TimeRange.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.time-range", item.TimeRange.ValueString())
			}
			if !item.Tos.IsNull() && !item.Tos.IsUnknown() {
				body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.tos", item.Tos.ValueString())
			}
			if !item.Log.IsNull() && !item.Log.IsUnknown() {
				if item.Log.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.log", map[string]string{})
				}
			}
			if !item.LogInput.IsNull() && !item.LogInput.IsUnknown() {
				if item.LogInput.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.log-input", map[string]string{})
				}
			}
			if !item.MatchAllPlusack.IsNull() && !item.MatchAllPlusack.IsUnknown() {
				if item.MatchAllPlusack.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.plusack", map[string]string{})
				}
			}
			if !item.MatchAllPlusfin.IsNull() && !item.MatchAllPlusfin.IsUnknown() {
				if item.MatchAllPlusfin.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.plusfin", map[string]string{})
				}
			}
			if !item.MatchAllPluspsh.IsNull() && !item.MatchAllPluspsh.IsUnknown() {
				if item.MatchAllPluspsh.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.pluspsh", map[string]string{})
				}
			}
			if !item.MatchAllPlusrst.IsNull() && !item.MatchAllPlusrst.IsUnknown() {
				if item.MatchAllPlusrst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.plusrst", map[string]string{})
				}
			}
			if !item.MatchAllPlussyn.IsNull() && !item.MatchAllPlussyn.IsUnknown() {
				if item.MatchAllPlussyn.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.plussyn", map[string]string{})
				}
			}
			if !item.MatchAllPlusurg.IsNull() && !item.MatchAllPlusurg.IsUnknown() {
				if item.MatchAllPlusurg.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.plusurg", map[string]string{})
				}
			}
			if !item.MatchAllMinusack.IsNull() && !item.MatchAllMinusack.IsUnknown() {
				if item.MatchAllMinusack.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.minusack", map[string]string{})
				}
			}
			if !item.MatchAllMinusfin.IsNull() && !item.MatchAllMinusfin.IsUnknown() {
				if item.MatchAllMinusfin.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.minusfin", map[string]string{})
				}
			}
			if !item.MatchAllMinuspsh.IsNull() && !item.MatchAllMinuspsh.IsUnknown() {
				if item.MatchAllMinuspsh.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.minuspsh", map[string]string{})
				}
			}
			if !item.MatchAllMinusrst.IsNull() && !item.MatchAllMinusrst.IsUnknown() {
				if item.MatchAllMinusrst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.minusrst", map[string]string{})
				}
			}
			if !item.MatchAllMinussyn.IsNull() && !item.MatchAllMinussyn.IsUnknown() {
				if item.MatchAllMinussyn.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.minussyn", map[string]string{})
				}
			}
			if !item.MatchAllMinusurg.IsNull() && !item.MatchAllMinusurg.IsUnknown() {
				if item.MatchAllMinusurg.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-all.minusurg", map[string]string{})
				}
			}
			if !item.MatchAnyPlusack.IsNull() && !item.MatchAnyPlusack.IsUnknown() {
				if item.MatchAnyPlusack.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.plusack", map[string]string{})
				}
			}
			if !item.MatchAnyPlusfin.IsNull() && !item.MatchAnyPlusfin.IsUnknown() {
				if item.MatchAnyPlusfin.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.plusfin", map[string]string{})
				}
			}
			if !item.MatchAnyPluspsh.IsNull() && !item.MatchAnyPluspsh.IsUnknown() {
				if item.MatchAnyPluspsh.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.pluspsh", map[string]string{})
				}
			}
			if !item.MatchAnyPlusrst.IsNull() && !item.MatchAnyPlusrst.IsUnknown() {
				if item.MatchAnyPlusrst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.plusrst", map[string]string{})
				}
			}
			if !item.MatchAnyPlussyn.IsNull() && !item.MatchAnyPlussyn.IsUnknown() {
				if item.MatchAnyPlussyn.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.plussyn", map[string]string{})
				}
			}
			if !item.MatchAnyPlusurg.IsNull() && !item.MatchAnyPlusurg.IsUnknown() {
				if item.MatchAnyPlusurg.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.plusurg", map[string]string{})
				}
			}
			if !item.MatchAnyMinusack.IsNull() && !item.MatchAnyMinusack.IsUnknown() {
				if item.MatchAnyMinusack.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.minusack", map[string]string{})
				}
			}
			if !item.MatchAnyMinusfin.IsNull() && !item.MatchAnyMinusfin.IsUnknown() {
				if item.MatchAnyMinusfin.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.minusfin", map[string]string{})
				}
			}
			if !item.MatchAnyMinuspsh.IsNull() && !item.MatchAnyMinuspsh.IsUnknown() {
				if item.MatchAnyMinuspsh.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.minuspsh", map[string]string{})
				}
			}
			if !item.MatchAnyMinusrst.IsNull() && !item.MatchAnyMinusrst.IsUnknown() {
				if item.MatchAnyMinusrst.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.minusrst", map[string]string{})
				}
			}
			if !item.MatchAnyMinussyn.IsNull() && !item.MatchAnyMinussyn.IsUnknown() {
				if item.MatchAnyMinussyn.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.minussyn", map[string]string{})
				}
			}
			if !item.MatchAnyMinusurg.IsNull() && !item.MatchAnyMinusurg.IsUnknown() {
				if item.MatchAnyMinusurg.ValueBool() {
					body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"access-list-seq-rule"+"."+strconv.Itoa(index)+"."+"ace-rule.match-any.minusurg", 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 *AccessListRoleBased) 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 + "name"); value.Exists() && !data.Name.IsNull() {
		data.Name = types.StringValue(value.String())
	} else {
		data.Name = types.StringNull()
	}
	for i := range data.Entries {
		keys := [...]string{"sequence"}
		keyValues := [...]string{strconv.FormatInt(data.Entries[i].Sequence.ValueInt64(), 10)}

		var r gjson.Result
		res.Get(prefix + "access-list-seq-rule").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("sequence"); value.Exists() && !data.Entries[i].Sequence.IsNull() {
			data.Entries[i].Sequence = types.Int64Value(value.Int())
		} else {
			data.Entries[i].Sequence = types.Int64Null()
		}
		if value := r.Get("remark"); value.Exists() && !data.Entries[i].Remark.IsNull() {
			data.Entries[i].Remark = types.StringValue(value.String())
		} else {
			data.Entries[i].Remark = types.StringNull()
		}
		if value := r.Get("ace-rule.action"); value.Exists() && !data.Entries[i].AceRuleAction.IsNull() {
			data.Entries[i].AceRuleAction = types.StringValue(value.String())
		} else {
			data.Entries[i].AceRuleAction = types.StringNull()
		}
		if value := r.Get("ace-rule.protocol"); value.Exists() && !data.Entries[i].AceRuleProtocol.IsNull() {
			data.Entries[i].AceRuleProtocol = types.StringValue(value.String())
		} else {
			data.Entries[i].AceRuleProtocol = types.StringNull()
		}
		if value := r.Get("ace-rule.ack"); !data.Entries[i].Ack.IsNull() {
			if value.Exists() {
				data.Entries[i].Ack = types.BoolValue(true)
			} else {
				data.Entries[i].Ack = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Ack = types.BoolNull()
		}
		if value := r.Get("ace-rule.fin"); !data.Entries[i].Fin.IsNull() {
			if value.Exists() {
				data.Entries[i].Fin = types.BoolValue(true)
			} else {
				data.Entries[i].Fin = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Fin = types.BoolNull()
		}
		if value := r.Get("ace-rule.psh"); !data.Entries[i].Psh.IsNull() {
			if value.Exists() {
				data.Entries[i].Psh = types.BoolValue(true)
			} else {
				data.Entries[i].Psh = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Psh = types.BoolNull()
		}
		if value := r.Get("ace-rule.rst"); !data.Entries[i].Rst.IsNull() {
			if value.Exists() {
				data.Entries[i].Rst = types.BoolValue(true)
			} else {
				data.Entries[i].Rst = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Rst = types.BoolNull()
		}
		if value := r.Get("ace-rule.syn"); !data.Entries[i].Syn.IsNull() {
			if value.Exists() {
				data.Entries[i].Syn = types.BoolValue(true)
			} else {
				data.Entries[i].Syn = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Syn = types.BoolNull()
		}
		if value := r.Get("ace-rule.urg"); !data.Entries[i].Urg.IsNull() {
			if value.Exists() {
				data.Entries[i].Urg = types.BoolValue(true)
			} else {
				data.Entries[i].Urg = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Urg = types.BoolNull()
		}
		if value := r.Get("ace-rule.established"); !data.Entries[i].Established.IsNull() {
			if value.Exists() {
				data.Entries[i].Established = types.BoolValue(true)
			} else {
				data.Entries[i].Established = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Established = types.BoolNull()
		}
		if value := r.Get("ace-rule.dscp"); value.Exists() && !data.Entries[i].Dscp.IsNull() {
			data.Entries[i].Dscp = types.StringValue(value.String())
		} else {
			data.Entries[i].Dscp = types.StringNull()
		}
		if value := r.Get("ace-rule.fragments"); !data.Entries[i].Fragments.IsNull() {
			if value.Exists() {
				data.Entries[i].Fragments = types.BoolValue(true)
			} else {
				data.Entries[i].Fragments = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Fragments = types.BoolNull()
		}
		if value := r.Get("ace-rule.option"); value.Exists() && !data.Entries[i].Option.IsNull() {
			data.Entries[i].Option = types.StringValue(value.String())
		} else {
			data.Entries[i].Option = types.StringNull()
		}
		if value := r.Get("ace-rule.precedence"); value.Exists() && !data.Entries[i].Precedence.IsNull() {
			data.Entries[i].Precedence = types.StringValue(value.String())
		} else {
			data.Entries[i].Precedence = types.StringNull()
		}
		if value := r.Get("ace-rule.time-range"); value.Exists() && !data.Entries[i].TimeRange.IsNull() {
			data.Entries[i].TimeRange = types.StringValue(value.String())
		} else {
			data.Entries[i].TimeRange = types.StringNull()
		}
		if value := r.Get("ace-rule.tos"); value.Exists() && !data.Entries[i].Tos.IsNull() {
			data.Entries[i].Tos = types.StringValue(value.String())
		} else {
			data.Entries[i].Tos = types.StringNull()
		}
		if value := r.Get("ace-rule.log"); !data.Entries[i].Log.IsNull() {
			if value.Exists() {
				data.Entries[i].Log = types.BoolValue(true)
			} else {
				data.Entries[i].Log = types.BoolValue(false)
			}
		} else {
			data.Entries[i].Log = types.BoolNull()
		}
		if value := r.Get("ace-rule.log-input"); !data.Entries[i].LogInput.IsNull() {
			if value.Exists() {
				data.Entries[i].LogInput = types.BoolValue(true)
			} else {
				data.Entries[i].LogInput = types.BoolValue(false)
			}
		} else {
			data.Entries[i].LogInput = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.plusack"); !data.Entries[i].MatchAllPlusack.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllPlusack = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllPlusack = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllPlusack = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.plusfin"); !data.Entries[i].MatchAllPlusfin.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllPlusfin = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllPlusfin = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllPlusfin = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.pluspsh"); !data.Entries[i].MatchAllPluspsh.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllPluspsh = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllPluspsh = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllPluspsh = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.plusrst"); !data.Entries[i].MatchAllPlusrst.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllPlusrst = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllPlusrst = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllPlusrst = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.plussyn"); !data.Entries[i].MatchAllPlussyn.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllPlussyn = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllPlussyn = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllPlussyn = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.plusurg"); !data.Entries[i].MatchAllPlusurg.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllPlusurg = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllPlusurg = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllPlusurg = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.minusack"); !data.Entries[i].MatchAllMinusack.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllMinusack = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllMinusack = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllMinusack = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.minusfin"); !data.Entries[i].MatchAllMinusfin.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllMinusfin = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllMinusfin = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllMinusfin = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.minuspsh"); !data.Entries[i].MatchAllMinuspsh.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllMinuspsh = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllMinuspsh = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllMinuspsh = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.minusrst"); !data.Entries[i].MatchAllMinusrst.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllMinusrst = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllMinusrst = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllMinusrst = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.minussyn"); !data.Entries[i].MatchAllMinussyn.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllMinussyn = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllMinussyn = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllMinussyn = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-all.minusurg"); !data.Entries[i].MatchAllMinusurg.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAllMinusurg = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAllMinusurg = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAllMinusurg = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.plusack"); !data.Entries[i].MatchAnyPlusack.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyPlusack = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyPlusack = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyPlusack = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.plusfin"); !data.Entries[i].MatchAnyPlusfin.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyPlusfin = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyPlusfin = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyPlusfin = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.pluspsh"); !data.Entries[i].MatchAnyPluspsh.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyPluspsh = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyPluspsh = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyPluspsh = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.plusrst"); !data.Entries[i].MatchAnyPlusrst.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyPlusrst = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyPlusrst = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyPlusrst = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.plussyn"); !data.Entries[i].MatchAnyPlussyn.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyPlussyn = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyPlussyn = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyPlussyn = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.plusurg"); !data.Entries[i].MatchAnyPlusurg.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyPlusurg = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyPlusurg = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyPlusurg = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.minusack"); !data.Entries[i].MatchAnyMinusack.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyMinusack = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyMinusack = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyMinusack = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.minusfin"); !data.Entries[i].MatchAnyMinusfin.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyMinusfin = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyMinusfin = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyMinusfin = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.minuspsh"); !data.Entries[i].MatchAnyMinuspsh.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyMinuspsh = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyMinuspsh = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyMinuspsh = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.minusrst"); !data.Entries[i].MatchAnyMinusrst.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyMinusrst = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyMinusrst = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyMinusrst = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.minussyn"); !data.Entries[i].MatchAnyMinussyn.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyMinussyn = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyMinussyn = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyMinussyn = types.BoolNull()
		}
		if value := r.Get("ace-rule.match-any.minusurg"); !data.Entries[i].MatchAnyMinusurg.IsNull() {
			if value.Exists() {
				data.Entries[i].MatchAnyMinusurg = types.BoolValue(true)
			} else {
				data.Entries[i].MatchAnyMinusurg = types.BoolValue(false)
			}
		} else {
			data.Entries[i].MatchAnyMinusurg = types.BoolNull()
		}
	}
}

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

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

func (data *AccessListRoleBased) 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 + "access-list-seq-rule"); value.Exists() {
		data.Entries = make([]AccessListRoleBasedEntries, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := AccessListRoleBasedEntries{}
			if cValue := v.Get("sequence"); cValue.Exists() {
				item.Sequence = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("remark"); cValue.Exists() {
				item.Remark = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.action"); cValue.Exists() {
				item.AceRuleAction = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.protocol"); cValue.Exists() {
				item.AceRuleProtocol = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.ack"); cValue.Exists() {
				item.Ack = types.BoolValue(true)
			} else {
				item.Ack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.fin"); cValue.Exists() {
				item.Fin = types.BoolValue(true)
			} else {
				item.Fin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.psh"); cValue.Exists() {
				item.Psh = types.BoolValue(true)
			} else {
				item.Psh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.rst"); cValue.Exists() {
				item.Rst = types.BoolValue(true)
			} else {
				item.Rst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.syn"); cValue.Exists() {
				item.Syn = types.BoolValue(true)
			} else {
				item.Syn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.urg"); cValue.Exists() {
				item.Urg = types.BoolValue(true)
			} else {
				item.Urg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.established"); cValue.Exists() {
				item.Established = types.BoolValue(true)
			} else {
				item.Established = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.dscp"); cValue.Exists() {
				item.Dscp = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.fragments"); cValue.Exists() {
				item.Fragments = types.BoolValue(true)
			} else {
				item.Fragments = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.option"); cValue.Exists() {
				item.Option = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.precedence"); cValue.Exists() {
				item.Precedence = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.time-range"); cValue.Exists() {
				item.TimeRange = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.tos"); cValue.Exists() {
				item.Tos = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.log"); cValue.Exists() {
				item.Log = types.BoolValue(true)
			} else {
				item.Log = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.log-input"); cValue.Exists() {
				item.LogInput = types.BoolValue(true)
			} else {
				item.LogInput = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusack"); cValue.Exists() {
				item.MatchAllPlusack = types.BoolValue(true)
			} else {
				item.MatchAllPlusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusfin"); cValue.Exists() {
				item.MatchAllPlusfin = types.BoolValue(true)
			} else {
				item.MatchAllPlusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.pluspsh"); cValue.Exists() {
				item.MatchAllPluspsh = types.BoolValue(true)
			} else {
				item.MatchAllPluspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusrst"); cValue.Exists() {
				item.MatchAllPlusrst = types.BoolValue(true)
			} else {
				item.MatchAllPlusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plussyn"); cValue.Exists() {
				item.MatchAllPlussyn = types.BoolValue(true)
			} else {
				item.MatchAllPlussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusurg"); cValue.Exists() {
				item.MatchAllPlusurg = types.BoolValue(true)
			} else {
				item.MatchAllPlusurg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusack"); cValue.Exists() {
				item.MatchAllMinusack = types.BoolValue(true)
			} else {
				item.MatchAllMinusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusfin"); cValue.Exists() {
				item.MatchAllMinusfin = types.BoolValue(true)
			} else {
				item.MatchAllMinusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minuspsh"); cValue.Exists() {
				item.MatchAllMinuspsh = types.BoolValue(true)
			} else {
				item.MatchAllMinuspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusrst"); cValue.Exists() {
				item.MatchAllMinusrst = types.BoolValue(true)
			} else {
				item.MatchAllMinusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minussyn"); cValue.Exists() {
				item.MatchAllMinussyn = types.BoolValue(true)
			} else {
				item.MatchAllMinussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusurg"); cValue.Exists() {
				item.MatchAllMinusurg = types.BoolValue(true)
			} else {
				item.MatchAllMinusurg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusack"); cValue.Exists() {
				item.MatchAnyPlusack = types.BoolValue(true)
			} else {
				item.MatchAnyPlusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusfin"); cValue.Exists() {
				item.MatchAnyPlusfin = types.BoolValue(true)
			} else {
				item.MatchAnyPlusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.pluspsh"); cValue.Exists() {
				item.MatchAnyPluspsh = types.BoolValue(true)
			} else {
				item.MatchAnyPluspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusrst"); cValue.Exists() {
				item.MatchAnyPlusrst = types.BoolValue(true)
			} else {
				item.MatchAnyPlusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plussyn"); cValue.Exists() {
				item.MatchAnyPlussyn = types.BoolValue(true)
			} else {
				item.MatchAnyPlussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusurg"); cValue.Exists() {
				item.MatchAnyPlusurg = types.BoolValue(true)
			} else {
				item.MatchAnyPlusurg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusack"); cValue.Exists() {
				item.MatchAnyMinusack = types.BoolValue(true)
			} else {
				item.MatchAnyMinusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusfin"); cValue.Exists() {
				item.MatchAnyMinusfin = types.BoolValue(true)
			} else {
				item.MatchAnyMinusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minuspsh"); cValue.Exists() {
				item.MatchAnyMinuspsh = types.BoolValue(true)
			} else {
				item.MatchAnyMinuspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusrst"); cValue.Exists() {
				item.MatchAnyMinusrst = types.BoolValue(true)
			} else {
				item.MatchAnyMinusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minussyn"); cValue.Exists() {
				item.MatchAnyMinussyn = types.BoolValue(true)
			} else {
				item.MatchAnyMinussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusurg"); cValue.Exists() {
				item.MatchAnyMinusurg = types.BoolValue(true)
			} else {
				item.MatchAnyMinusurg = types.BoolValue(false)
			}
			data.Entries = append(data.Entries, item)
			return true
		})
	}
}

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

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

func (data *AccessListRoleBasedData) 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 + "access-list-seq-rule"); value.Exists() {
		data.Entries = make([]AccessListRoleBasedEntries, 0)
		value.ForEach(func(k, v gjson.Result) bool {
			item := AccessListRoleBasedEntries{}
			if cValue := v.Get("sequence"); cValue.Exists() {
				item.Sequence = types.Int64Value(cValue.Int())
			}
			if cValue := v.Get("remark"); cValue.Exists() {
				item.Remark = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.action"); cValue.Exists() {
				item.AceRuleAction = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.protocol"); cValue.Exists() {
				item.AceRuleProtocol = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.ack"); cValue.Exists() {
				item.Ack = types.BoolValue(true)
			} else {
				item.Ack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.fin"); cValue.Exists() {
				item.Fin = types.BoolValue(true)
			} else {
				item.Fin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.psh"); cValue.Exists() {
				item.Psh = types.BoolValue(true)
			} else {
				item.Psh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.rst"); cValue.Exists() {
				item.Rst = types.BoolValue(true)
			} else {
				item.Rst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.syn"); cValue.Exists() {
				item.Syn = types.BoolValue(true)
			} else {
				item.Syn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.urg"); cValue.Exists() {
				item.Urg = types.BoolValue(true)
			} else {
				item.Urg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.established"); cValue.Exists() {
				item.Established = types.BoolValue(true)
			} else {
				item.Established = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.dscp"); cValue.Exists() {
				item.Dscp = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.fragments"); cValue.Exists() {
				item.Fragments = types.BoolValue(true)
			} else {
				item.Fragments = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.option"); cValue.Exists() {
				item.Option = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.precedence"); cValue.Exists() {
				item.Precedence = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.time-range"); cValue.Exists() {
				item.TimeRange = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.tos"); cValue.Exists() {
				item.Tos = types.StringValue(cValue.String())
			}
			if cValue := v.Get("ace-rule.log"); cValue.Exists() {
				item.Log = types.BoolValue(true)
			} else {
				item.Log = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.log-input"); cValue.Exists() {
				item.LogInput = types.BoolValue(true)
			} else {
				item.LogInput = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusack"); cValue.Exists() {
				item.MatchAllPlusack = types.BoolValue(true)
			} else {
				item.MatchAllPlusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusfin"); cValue.Exists() {
				item.MatchAllPlusfin = types.BoolValue(true)
			} else {
				item.MatchAllPlusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.pluspsh"); cValue.Exists() {
				item.MatchAllPluspsh = types.BoolValue(true)
			} else {
				item.MatchAllPluspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusrst"); cValue.Exists() {
				item.MatchAllPlusrst = types.BoolValue(true)
			} else {
				item.MatchAllPlusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plussyn"); cValue.Exists() {
				item.MatchAllPlussyn = types.BoolValue(true)
			} else {
				item.MatchAllPlussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.plusurg"); cValue.Exists() {
				item.MatchAllPlusurg = types.BoolValue(true)
			} else {
				item.MatchAllPlusurg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusack"); cValue.Exists() {
				item.MatchAllMinusack = types.BoolValue(true)
			} else {
				item.MatchAllMinusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusfin"); cValue.Exists() {
				item.MatchAllMinusfin = types.BoolValue(true)
			} else {
				item.MatchAllMinusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minuspsh"); cValue.Exists() {
				item.MatchAllMinuspsh = types.BoolValue(true)
			} else {
				item.MatchAllMinuspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusrst"); cValue.Exists() {
				item.MatchAllMinusrst = types.BoolValue(true)
			} else {
				item.MatchAllMinusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minussyn"); cValue.Exists() {
				item.MatchAllMinussyn = types.BoolValue(true)
			} else {
				item.MatchAllMinussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-all.minusurg"); cValue.Exists() {
				item.MatchAllMinusurg = types.BoolValue(true)
			} else {
				item.MatchAllMinusurg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusack"); cValue.Exists() {
				item.MatchAnyPlusack = types.BoolValue(true)
			} else {
				item.MatchAnyPlusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusfin"); cValue.Exists() {
				item.MatchAnyPlusfin = types.BoolValue(true)
			} else {
				item.MatchAnyPlusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.pluspsh"); cValue.Exists() {
				item.MatchAnyPluspsh = types.BoolValue(true)
			} else {
				item.MatchAnyPluspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusrst"); cValue.Exists() {
				item.MatchAnyPlusrst = types.BoolValue(true)
			} else {
				item.MatchAnyPlusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plussyn"); cValue.Exists() {
				item.MatchAnyPlussyn = types.BoolValue(true)
			} else {
				item.MatchAnyPlussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.plusurg"); cValue.Exists() {
				item.MatchAnyPlusurg = types.BoolValue(true)
			} else {
				item.MatchAnyPlusurg = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusack"); cValue.Exists() {
				item.MatchAnyMinusack = types.BoolValue(true)
			} else {
				item.MatchAnyMinusack = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusfin"); cValue.Exists() {
				item.MatchAnyMinusfin = types.BoolValue(true)
			} else {
				item.MatchAnyMinusfin = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minuspsh"); cValue.Exists() {
				item.MatchAnyMinuspsh = types.BoolValue(true)
			} else {
				item.MatchAnyMinuspsh = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusrst"); cValue.Exists() {
				item.MatchAnyMinusrst = types.BoolValue(true)
			} else {
				item.MatchAnyMinusrst = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minussyn"); cValue.Exists() {
				item.MatchAnyMinussyn = types.BoolValue(true)
			} else {
				item.MatchAnyMinussyn = types.BoolValue(false)
			}
			if cValue := v.Get("ace-rule.match-any.minusurg"); cValue.Exists() {
				item.MatchAnyMinusurg = types.BoolValue(true)
			} else {
				item.MatchAnyMinusurg = types.BoolValue(false)
			}
			data.Entries = append(data.Entries, item)
			return true
		})
	}
}

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

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

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

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

		found := false
		for j := range data.Entries {
			found = true
			if state.Entries[i].Sequence.ValueInt64() != data.Entries[j].Sequence.ValueInt64() {
				found = false
			}
			if found {
				if !state.Entries[i].MatchAnyMinusurg.IsNull() && data.Entries[j].MatchAnyMinusurg.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusurg", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyMinussyn.IsNull() && data.Entries[j].MatchAnyMinussyn.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minussyn", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyMinusrst.IsNull() && data.Entries[j].MatchAnyMinusrst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusrst", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyMinuspsh.IsNull() && data.Entries[j].MatchAnyMinuspsh.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minuspsh", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyMinusfin.IsNull() && data.Entries[j].MatchAnyMinusfin.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusfin", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyMinusack.IsNull() && data.Entries[j].MatchAnyMinusack.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusack", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyPlusurg.IsNull() && data.Entries[j].MatchAnyPlusurg.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusurg", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyPlussyn.IsNull() && data.Entries[j].MatchAnyPlussyn.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plussyn", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyPlusrst.IsNull() && data.Entries[j].MatchAnyPlusrst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusrst", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyPluspsh.IsNull() && data.Entries[j].MatchAnyPluspsh.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/pluspsh", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyPlusfin.IsNull() && data.Entries[j].MatchAnyPlusfin.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusfin", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAnyPlusack.IsNull() && data.Entries[j].MatchAnyPlusack.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusack", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllMinusurg.IsNull() && data.Entries[j].MatchAllMinusurg.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusurg", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllMinussyn.IsNull() && data.Entries[j].MatchAllMinussyn.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minussyn", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllMinusrst.IsNull() && data.Entries[j].MatchAllMinusrst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusrst", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllMinuspsh.IsNull() && data.Entries[j].MatchAllMinuspsh.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minuspsh", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllMinusfin.IsNull() && data.Entries[j].MatchAllMinusfin.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusfin", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllMinusack.IsNull() && data.Entries[j].MatchAllMinusack.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusack", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllPlusurg.IsNull() && data.Entries[j].MatchAllPlusurg.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusurg", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllPlussyn.IsNull() && data.Entries[j].MatchAllPlussyn.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plussyn", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllPlusrst.IsNull() && data.Entries[j].MatchAllPlusrst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusrst", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllPluspsh.IsNull() && data.Entries[j].MatchAllPluspsh.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/pluspsh", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllPlusfin.IsNull() && data.Entries[j].MatchAllPlusfin.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusfin", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].MatchAllPlusack.IsNull() && data.Entries[j].MatchAllPlusack.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusack", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].LogInput.IsNull() && data.Entries[j].LogInput.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/log-input", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Log.IsNull() && data.Entries[j].Log.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/log", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Tos.IsNull() && data.Entries[j].Tos.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/tos", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].TimeRange.IsNull() && data.Entries[j].TimeRange.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/time-range", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Precedence.IsNull() && data.Entries[j].Precedence.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/precedence", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Option.IsNull() && data.Entries[j].Option.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/option", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Fragments.IsNull() && data.Entries[j].Fragments.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/fragments", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Dscp.IsNull() && data.Entries[j].Dscp.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/dscp", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Established.IsNull() && data.Entries[j].Established.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/established", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Urg.IsNull() && data.Entries[j].Urg.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/urg", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Syn.IsNull() && data.Entries[j].Syn.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/syn", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Rst.IsNull() && data.Entries[j].Rst.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/rst", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Psh.IsNull() && data.Entries[j].Psh.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/psh", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Fin.IsNull() && data.Entries[j].Fin.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/fin", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Ack.IsNull() && data.Entries[j].Ack.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/ack", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].AceRuleProtocol.IsNull() && data.Entries[j].AceRuleProtocol.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/protocol", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].AceRuleAction.IsNull() && data.Entries[j].AceRuleAction.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/action", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				if !state.Entries[i].Remark.IsNull() && data.Entries[j].Remark.IsNull() {
					deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%v/remark", state.getPath(), strings.Join(stateKeyValues[:], ",")))
				}
				break
			}
		}
		if !found {
			deletedItems = append(deletedItems, fmt.Sprintf("%v/access-list-seq-rule=%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 *AccessListRoleBased) getEmptyLeafsDelete(ctx context.Context) []string {
	emptyLeafsDelete := make([]string, 0)

	for i := range data.Entries {
		keyValues := [...]string{strconv.FormatInt(data.Entries[i].Sequence.ValueInt64(), 10)}
		if !data.Entries[i].MatchAnyMinusurg.IsNull() && !data.Entries[i].MatchAnyMinusurg.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusurg", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyMinussyn.IsNull() && !data.Entries[i].MatchAnyMinussyn.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minussyn", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyMinusrst.IsNull() && !data.Entries[i].MatchAnyMinusrst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusrst", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyMinuspsh.IsNull() && !data.Entries[i].MatchAnyMinuspsh.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minuspsh", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyMinusfin.IsNull() && !data.Entries[i].MatchAnyMinusfin.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusfin", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyMinusack.IsNull() && !data.Entries[i].MatchAnyMinusack.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/minusack", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyPlusurg.IsNull() && !data.Entries[i].MatchAnyPlusurg.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusurg", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyPlussyn.IsNull() && !data.Entries[i].MatchAnyPlussyn.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plussyn", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyPlusrst.IsNull() && !data.Entries[i].MatchAnyPlusrst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusrst", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyPluspsh.IsNull() && !data.Entries[i].MatchAnyPluspsh.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/pluspsh", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyPlusfin.IsNull() && !data.Entries[i].MatchAnyPlusfin.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusfin", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAnyPlusack.IsNull() && !data.Entries[i].MatchAnyPlusack.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-any/plusack", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllMinusurg.IsNull() && !data.Entries[i].MatchAllMinusurg.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusurg", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllMinussyn.IsNull() && !data.Entries[i].MatchAllMinussyn.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minussyn", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllMinusrst.IsNull() && !data.Entries[i].MatchAllMinusrst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusrst", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllMinuspsh.IsNull() && !data.Entries[i].MatchAllMinuspsh.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minuspsh", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllMinusfin.IsNull() && !data.Entries[i].MatchAllMinusfin.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusfin", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllMinusack.IsNull() && !data.Entries[i].MatchAllMinusack.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/minusack", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllPlusurg.IsNull() && !data.Entries[i].MatchAllPlusurg.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusurg", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllPlussyn.IsNull() && !data.Entries[i].MatchAllPlussyn.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plussyn", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllPlusrst.IsNull() && !data.Entries[i].MatchAllPlusrst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusrst", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllPluspsh.IsNull() && !data.Entries[i].MatchAllPluspsh.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/pluspsh", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllPlusfin.IsNull() && !data.Entries[i].MatchAllPlusfin.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusfin", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].MatchAllPlusack.IsNull() && !data.Entries[i].MatchAllPlusack.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/match-all/plusack", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].LogInput.IsNull() && !data.Entries[i].LogInput.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/log-input", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Log.IsNull() && !data.Entries[i].Log.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/log", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Fragments.IsNull() && !data.Entries[i].Fragments.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/fragments", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Established.IsNull() && !data.Entries[i].Established.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/established", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Urg.IsNull() && !data.Entries[i].Urg.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/urg", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Syn.IsNull() && !data.Entries[i].Syn.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/syn", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Rst.IsNull() && !data.Entries[i].Rst.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/rst", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Psh.IsNull() && !data.Entries[i].Psh.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/psh", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Fin.IsNull() && !data.Entries[i].Fin.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/fin", data.getPath(), strings.Join(keyValues[:], ",")))
		}
		if !data.Entries[i].Ack.IsNull() && !data.Entries[i].Ack.ValueBool() {
			emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/access-list-seq-rule=%v/ace-rule/ack", 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 *AccessListRoleBased) getDeletePaths(ctx context.Context) []string {
	var deletePaths []string
	for i := range data.Entries {
		keyValues := [...]string{strconv.FormatInt(data.Entries[i].Sequence.ValueInt64(), 10)}

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

	return deletePaths
}

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