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

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

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

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

func TestAccIosxeLine(t *testing.T) {
	if os.Getenv("LINE") == "" {
		t.Skip("skipping test, set environment variable LINE")
	}
	var checks []resource.TestCheckFunc
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.first", "0"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.exec_timeout_minutes", "45"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.exec_timeout_seconds", "25"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.privilege_level", "15"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.stopbits", "1"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.logging_synchronous", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.first", "10"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.last", "27"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_classes.0.direction", "in"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_classes.0.access_list", "2"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_classes.0.vrf_also", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.exec_timeout_minutes", "45"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.exec_timeout_seconds", "25"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.transport_preferred_protocol", "none"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.escape_character", "BREAK"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.authorization_exec_default", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.transport_input.0", "ssh"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.monitor", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.logging_synchronous", "true"))
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t) },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config: testAccIosxeLineConfig_minimum(),
			},
			{
				Config: testAccIosxeLineConfig_all(),
				Check:  resource.ComposeTestCheckFunc(checks...),
			},
			{
				ResourceName:            "iosxe_line.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateIdFunc:       iosxeLineImportStateIdFunc("iosxe_line.test"),
				ImportStateVerifyIgnore: []string{"console.0.login_local", "console.0.transport_output_all", "console.0.transport_output_none", "vty.0.transport_input_all", "vty.0.transport_input_none", "vty.0.transport_output_all", "vty.0.transport_output_none"},
				Check:                   resource.ComposeTestCheckFunc(checks...),
			},
		},
	})
}

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

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

func iosxeLineImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
	return func(s *terraform.State) (string, error) {

		return fmt.Sprintf(""), nil
	}
}

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

// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
// End of section. //template:end testPrerequisites

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

func testAccIosxeLineConfig_minimum() string {
	config := `resource "iosxe_line" "test" {` + "\n"
	config += `}` + "\n"
	return config
}

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

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

func testAccIosxeLineConfig_all() string {
	config := `resource "iosxe_line" "test" {` + "\n"
	config += `	console = [{` + "\n"
	config += `		first = "0"` + "\n"
	config += `		exec_timeout_minutes = 45` + "\n"
	config += `		exec_timeout_seconds = 25` + "\n"
	config += `		privilege_level = 15` + "\n"
	config += `		stopbits = "1"` + "\n"
	config += `		password_type = "0"` + "\n"
	config += `		password = "testpasswd"` + "\n"
	config += `		logging_synchronous = true` + "\n"
	config += `	}]` + "\n"
	config += `	vty = [{` + "\n"
	config += `		first = 10` + "\n"
	config += `		last = 27` + "\n"
	config += `		access_classes = [{` + "\n"
	config += `			direction = "in"` + "\n"
	config += `			access_list = "2"` + "\n"
	config += `			vrf_also = true` + "\n"
	config += `		}]` + "\n"
	config += `		exec_timeout_minutes = 45` + "\n"
	config += `		exec_timeout_seconds = 25` + "\n"
	config += `		password_type = "0"` + "\n"
	config += `		password = "testpasswd"` + "\n"
	config += `		transport_preferred_protocol = "none"` + "\n"
	config += `		escape_character = "BREAK"` + "\n"
	config += `		authorization_exec_default = true` + "\n"
	config += `		transport_input = ["ssh"]` + "\n"
	config += `		monitor = true` + "\n"
	config += `		logging_synchronous = true` + "\n"
	config += `	}]` + "\n"
	config += `}` + "\n"
	return config
}

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