package redfishprofile

func dellProfile() Profile {
	return staticProfile{
		name:            "dell",
		priority:        20,
		safeForFallback: true,
		matchFn: func(s MatchSignals) int {
			score := 0
			if containsFold(s.SystemManufacturer, "dell") || containsFold(s.ChassisManufacturer, "dell") {
				score += 80
			}
			for _, ns := range s.OEMNamespaces {
				if containsFold(ns, "dell") {
					score += 30
					break
				}
			}
			if containsFold(s.ServiceRootProduct, "idrac") {
				score += 30
			}
			return min(score, 100)
		},
		extendAcquisition: func(plan *AcquisitionPlan, _ MatchSignals) {
			ensureRecoveryPolicy(plan, AcquisitionRecoveryPolicy{
				EnableProfilePlanB: true,
			})
			addPlanNote(plan, "dell iDRAC acquisition extensions enabled")
		},
		refineAcquisition: func(resolved *ResolvedAcquisitionPlan, discovered DiscoveredResources, _ MatchSignals) {
			for _, managerPath := range discovered.ManagerPaths {
				if !containsFold(managerPath, "idrac") {
					continue
				}
				addPlanPaths(&resolved.SeedPaths, managerPath)
				addPlanPaths(&resolved.Plan.SeedPaths, managerPath)
				addPlanPaths(&resolved.CriticalPaths, managerPath)
				addPlanPaths(&resolved.Plan.CriticalPaths, managerPath)
			}
		},
		applyAnalysisDirectives: func(d *AnalysisDirectives, _ MatchSignals) {
			d.EnableGenericGraphicsControllerDedup = true
		},
	}
}
