import type { WeightingKey } from '../domain/needBuilder'

type WeightProfile = Record<WeightingKey, number>

const PROFILES: Record<string, WeightProfile> = {
  OFFICE: {
    area: 0.20, location: 0.25, budget: 0.20, timing: 0.15,
    prestige: 0.10, accessibility: 0.05, expansionPotential: 0.03, flexibility: 0.02,
  },
  LOGISTICS: {
    area: 0.30, location: 0.20, budget: 0.20, timing: 0.15,
    prestige: 0.02, accessibility: 0.08, expansionPotential: 0.03, flexibility: 0.02,
  },
  RETAIL: {
    area: 0.15, location: 0.30, budget: 0.20, timing: 0.10,
    prestige: 0.12, accessibility: 0.08, expansionPotential: 0.03, flexibility: 0.02,
  },
  PRODUCTION: {
    area: 0.30, location: 0.20, budget: 0.20, timing: 0.15,
    prestige: 0.02, accessibility: 0.07, expansionPotential: 0.04, flexibility: 0.02,
  },
  DEFAULT: {
    area: 0.25, location: 0.25, budget: 0.20, timing: 0.15,
    prestige: 0.07, accessibility: 0.05, expansionPotential: 0.02, flexibility: 0.01,
  },
}

export const weightingService = {
  getDefaultWeights(assetType?: string): WeightProfile {
    return { ...(PROFILES[assetType ?? 'DEFAULT'] ?? PROFILES.DEFAULT) }
  },
}
