// 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 (
	"testing"

	"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

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

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

func TestAccDataSourceIosxePolicyMapEvent(t *testing.T) {
	var checks []resource.TestCheckFunc
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "match_type", "match-all"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.number", "10"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.class", "MY_CLASS"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.execution_type", "do-until-failure"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.number", "10"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.activate_service_template_config_service_template", "DEFAULT_LINK_POLICY"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.activate_service_template_config_aaa_list", "methodlist1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.activate_service_template_config_precedence", "1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.activate_interface_template", "templ1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.activate_policy_type_control_subscriber", "subscriber1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_method", "dot1x"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_retries", "2"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_retry_time", "0"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_priority", "10"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_aaa_authc_list", "listname1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_aaa_authz_list", "listname2"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authenticate_using_both", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.replace", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.restrict", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.clear_session", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.clear_authenticated_data_hosts_on_port", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.protect", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.err_disable", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.resume_reauthentication", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.authentication_restart", "2"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.set_domain", "data"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.unauthorize", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.notify", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.set_timer_name", "timer1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_policy_map_event.test", "class_numbers.0.action_numbers.0.set_timer_value", "3600"))
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t) },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config: testAccDataSourceIosxePolicyMapEventPrerequisitesConfig + testAccDataSourceIosxePolicyMapEventConfig(),
				Check:  resource.ComposeTestCheckFunc(checks...),
			},
		},
	})
}

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

// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
const testAccDataSourceIosxePolicyMapEventPrerequisitesConfig = `
resource "iosxe_restconf" "PreReq0" {
	path = "Cisco-IOS-XE-native:native/policy/Cisco-IOS-XE-policy:policy-map=dot1x_policy"
	attributes = {
		"name" = "dot1x_policy"
		"type" = "control"
		"subscriber" = ""
	}
}

resource "iosxe_restconf" "PreReq1" {
	path = "Cisco-IOS-XE-native:native/policy/Cisco-IOS-XE-policy:class-map=MY_CLASS"
	attributes = {
		"name" = "MY_CLASS"
		"type" = "control"
		"subscriber" = ""
		"prematch" = "match-all"
	}
}

`

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

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

func testAccDataSourceIosxePolicyMapEventConfig() string {
	config := `resource "iosxe_policy_map_event" "test" {` + "\n"
	config += `	name = "dot1x_policy"` + "\n"
	config += `	event_type = "authentication-success"` + "\n"
	config += `	match_type = "match-all"` + "\n"
	config += `	class_numbers = [{` + "\n"
	config += `		number = 10` + "\n"
	config += `		class = "MY_CLASS"` + "\n"
	config += `		execution_type = "do-until-failure"` + "\n"
	config += `		action_numbers = [{` + "\n"
	config += `			number = 10` + "\n"
	config += `			activate_service_template_config_service_template = "DEFAULT_LINK_POLICY"` + "\n"
	config += `			activate_service_template_config_aaa_list = "methodlist1"` + "\n"
	config += `			activate_service_template_config_precedence = 1` + "\n"
	config += `			activate_interface_template = "templ1"` + "\n"
	config += `			activate_policy_type_control_subscriber = "subscriber1"` + "\n"
	config += `			authenticate_using_method = "dot1x"` + "\n"
	config += `			authenticate_using_retries = 2` + "\n"
	config += `			authenticate_using_retry_time = 0` + "\n"
	config += `			authenticate_using_priority = 10` + "\n"
	config += `			authenticate_using_aaa_authc_list = "listname1"` + "\n"
	config += `			authenticate_using_aaa_authz_list = "listname2"` + "\n"
	config += `			authenticate_using_both = true` + "\n"
	config += `			replace = true` + "\n"
	config += `			restrict = true` + "\n"
	config += `			clear_session = true` + "\n"
	config += `			clear_authenticated_data_hosts_on_port = true` + "\n"
	config += `			protect = true` + "\n"
	config += `			err_disable = true` + "\n"
	config += `			resume_reauthentication = true` + "\n"
	config += `			authentication_restart = 2` + "\n"
	config += `			set_domain = "data"` + "\n"
	config += `			unauthorize = true` + "\n"
	config += `			notify = true` + "\n"
	config += `			set_timer_name = "timer1"` + "\n"
	config += `			set_timer_value = 3600` + "\n"
	config += `		}]` + "\n"
	config += `	}]` + "\n"
	config += `	depends_on = [iosxe_restconf.PreReq0, iosxe_restconf.PreReq1, ]` + "\n"
	config += `}` + "\n"

	config += `
		data "iosxe_policy_map_event" "test" {
			name = "dot1x_policy"
			event_type = "authentication-success"
			depends_on = [iosxe_policy_map_event.test]
		}
	`
	return config
}

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