"use client";
/** Grouped industry picker (Service-based · Product & manufacturing · Other) used for agencies, client workspaces and settings. */
import { INDUSTRY_GROUPS, INDUSTRY_OPTIONS } from "@/lib/industry";
import { Select } from "./ui";

export function IndustrySelect({ value, onChange, disabled }: { value: string; onChange: (v: string) => void; disabled?: boolean }) {
  return (
    <Select value={value} disabled={disabled} onChange={(e) => onChange(e.target.value)} aria-label="Industry">
      {INDUSTRY_GROUPS.map((g) => (
        <optgroup key={g.label} label={g.label}>
          {g.options.map((o) => <option key={o.value} value={o.value}>{o.label}</option>)}
        </optgroup>
      ))}
    </Select>
  );
}

export const industryExamples = (key: string) => INDUSTRY_OPTIONS.find((o) => o.value === key)?.examples ?? "";
