// Tenants — fintechs that use Mossad for AML compliance.
// Mossad currently runs single-tenant per session (one X-Tenant-ID per login), so there is
// exactly one real tenant to display. Its identity (name/sector/color) is fixture branding —
// there's no backend field for "sector" or "since" yet — but every number shown against it
// in tenants.jsx is computed live from the logged-in tenant's real alerts/cases/SARs/customers,
// not from a fixture.
const TENANTS = [
  {
    id: "northstar", name: "Snow", short: "Snow", initial: "S",
    color: "oklch(58% 0.16 252)", colorDark: "oklch(72% 0.16 252)",
    sector: "Stablecoin neobank · Global",
    since: "2023-Q1",
  },
];

function tenantForCustomer() {
  return TENANTS[0];
}
function getTenant() {
  return TENANTS[0];
}

// Compact tenant chip used inside table cells.
function TenantChip({ tenant, size = "md", showName = true }) {
  const isDark = document.documentElement.dataset.theme === "dark";
  const color = isDark ? tenant.colorDark : tenant.color;
  const isLight = false; // chip background is always saturated color
  const dim = size === "sm" ? 16 : 18;
  return (
    <span style={{ display: "inline-flex", alignItems: "center", gap: 6, minWidth: 0 }}>
      <span style={{
        width: dim, height: dim, borderRadius: 4,
        background: color, color: "#fff",
        display: "grid", placeItems: "center",
        fontSize: dim === 16 ? 9 : 10, fontWeight: 600,
        flexShrink: 0,
        boxShadow: "inset 0 0 0 1px rgba(255,255,255,.12)",
      }}>{tenant.initial}</span>
      {showName && <span style={{ fontSize: 12 }}>{tenant.short}</span>}
    </span>
  );
}

Object.assign(window, {
  TENANTS, tenantForCustomer, getTenant, TenantChip,
});
