package collector

import "testing"

func TestShouldIncludeCriticalPlanBPath(t *testing.T) {
	tests := []struct {
		name string
		req  Request
		path string
		want bool
	}{
		{
			name: "skip hgx erot pcie without extended diagnostics",
			req:  Request{},
			path: "/redfish/v1/Chassis/HGX_ERoT_NVSwitch_0/PCIeDevices",
			want: false,
		},
		{
			name: "skip hgx chassis assembly without extended diagnostics",
			req:  Request{},
			path: "/redfish/v1/Chassis/HGX_Chassis_0/Assembly",
			want: false,
		},
		{
			name: "keep standard chassis inventory without extended diagnostics",
			req:  Request{},
			path: "/redfish/v1/Chassis/1/PCIeDevices",
			want: true,
		},
		{
			name: "keep nvme storage backplane drives without extended diagnostics",
			req:  Request{},
			path: "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane/Drives",
			want: true,
		},
		{
			name: "keep system processors without extended diagnostics",
			req:  Request{},
			path: "/redfish/v1/Systems/HGX_Baseboard_0/Processors",
			want: true,
		},
		{
			name: "include hgx erot pcie when extended diagnostics enabled",
			req:  Request{DebugPayloads: true},
			path: "/redfish/v1/Chassis/HGX_ERoT_NVSwitch_0/PCIeDevices",
			want: true,
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := shouldIncludeCriticalPlanBPath(tt.req, tt.path); got != tt.want {
				t.Fatalf("shouldIncludeCriticalPlanBPath(%q) = %v, want %v", tt.path, got, tt.want)
			}
		})
	}
}
