import { useState as s, useCallback as l, useEffect as S } from "react";
import { i as b } from "./index-CwSaRXXg.js";
import { Laptop as v, Monitor as C, Database as L, Cloud as T, HardDrive as k, Landmark as O, Factory as B, Store as h, Warehouse as I, Crown as P, Users as F, Shield as M, Globe as U, Briefcase as _, Home as w, Building as D, Server as E, User as N, Building2 as d } from "lucide-react";
const H = {
  getAll: () => b.get("/administration/tenants/type-settings"),
  update: (e, a) => b.put(`/administration/tenants/type-settings/${e}`, a)
};
let r = null, n = null;
const u = {
  Personal: { icon: "User", iconType: "Lucide", color: "violet" },
  Business: { icon: "Building2", iconType: "Lucide", color: "blue" },
  System: { icon: "Server", iconType: "Lucide", color: "gray" }
};
function W() {
  const [e, a] = s(r ?? []), [y, g] = s(!r), [x, c] = s(null), i = l(async () => {
    try {
      g(!0), c(null), n || (n = H.getAll());
      const o = await n, t = Array.isArray(o) ? o : [];
      r = t, n = null, a(t);
    } catch {
      n = null, c("Failed to load tenant type settings");
    } finally {
      g(!1);
    }
  }, []);
  S(() => {
    r || i();
  }, [i]);
  const m = l(
    (o) => {
      const t = (e ?? []).find((A) => A.type === o);
      return t ? { icon: t.icon, iconType: t.iconType, color: t.color } : u[o] ?? u.Business;
    },
    [e]
  ), f = l(async () => {
    r = null, n = null, await i();
  }, [i]);
  return { settings: e, loading: y, error: x, getIconForType: m, reload: f };
}
const p = {
  Building2: d,
  User: N,
  Server: E,
  Building: D,
  Home: w,
  Briefcase: _,
  Globe: U,
  Shield: M,
  Users: F,
  Crown: P,
  Warehouse: I,
  Store: h,
  Factory: B,
  Landmark: O,
  HardDrive: k,
  Cloud: T,
  Database: L,
  Monitor: C,
  Laptop: v
}, $ = (e) => p[e] ?? d, q = () => Object.keys(p), z = (e) => ({
  blue: { bg: "bg-blue-500/10", text: "text-blue-500" },
  violet: { bg: "bg-violet-500/10", text: "text-violet-500" },
  gray: { bg: "bg-gray-500/10", text: "text-gray-500" },
  green: { bg: "bg-green-500/10", text: "text-green-500" },
  red: { bg: "bg-red-500/10", text: "text-red-500" },
  amber: { bg: "bg-amber-500/10", text: "text-amber-500" },
  purple: { bg: "bg-purple-500/10", text: "text-purple-500" },
  cyan: { bg: "bg-cyan-500/10", text: "text-cyan-500" },
  pink: { bg: "bg-pink-500/10", text: "text-pink-500" },
  emerald: { bg: "bg-emerald-500/10", text: "text-emerald-500" },
  orange: { bg: "bg-orange-500/10", text: "text-orange-500" },
  indigo: { bg: "bg-indigo-500/10", text: "text-indigo-500" }
})[e] ?? { bg: "bg-gray-500/10", text: "text-gray-500" }, J = () => [
  "blue",
  "violet",
  "gray",
  "green",
  "red",
  "amber",
  "purple",
  "cyan",
  "pink",
  "emerald",
  "orange",
  "indigo"
];
export {
  z as a,
  q as b,
  J as c,
  $ as g,
  H as t,
  W as u
};
//# sourceMappingURL=tenantIconMap-BpNANQ5s.js.map
