import { PropType } from "../Map/PropType";
import { ResourceType } from "./ResourceType";

export type DropRule = {
  resource: ResourceType;
  minTotal: number;
  maxTotal: number;
  minSpawnHits: number;
  maxSpawnHits: number;
};

export const PROP_DROPS: Record<PropType, DropRule[]> = {
  [PropType.Box]: [
    {
      resource: ResourceType.Wood,
      minTotal: 1,
      maxTotal: 4,
      minSpawnHits: 1,
      maxSpawnHits: 2,
    },
  ],
};

export function resolvePropType(objectName: string): PropType {
  const name = objectName.toLowerCase();
  if (name.includes("box") || name.includes("crate") || name.includes("wood")) {
    return PropType.Box;
  }

  console.warn(`Unknown prop type for "${objectName}", falling back to Box`);
  return PropType.Box;
}
