/**
 * Closed-set catalogue for `Structure.kind` per
 * [ADR-0027 §"Confirmation"](../../../../../docs/decisions/0027-portal-side-organisational-hierarchy.md).
 *
 * Three enforcement layers stack here (defense-in-depth, same posture
 * as ADR-0025's `Privilege` / `FunctionalRole` catalogues):
 *
 *   1. TypeScript type union `StructureKind` — compile-time check at
 *      every assignment / function call that uses the typed reference.
 *   2. Postgres `CHECK` constraint in the `add_org_hierarchy` migration
 *      — runtime enforcement at INSERT / UPDATE time, defends against
 *      any code path that bypasses the type system (raw SQL, casts,
 *      future API endpoints with untrusted input).
 *   3. `scripts/check-catalogue-drift.mjs` — CI gate asserting every
 *      `kind: 'X'` literal in files that import this module is in the
 *      catalogue.
 *
 * Cascade's `Structure.type` discriminator is the source of the
 * vocabulary; the portal preserves cascade's spelling so the future
 * cascade sync (ADR-0029) writes additively without translation.
 */
export const STRUCTURE_KINDS = [
  'medico_social',
  'antenne',
  'dispositif',
  'entreprise_adaptee',
  'mouvement',
  'administratif',
  'siege',
] as const;

export type StructureKind = (typeof STRUCTURE_KINDS)[number];

export function isStructureKind(value: string): value is StructureKind {
  return (STRUCTURE_KINDS as readonly string[]).includes(value);
}
